Skip to content

missing-copy-implementations warning only triggers on externally-reachable types. #19712

Closed
@ben0x539

Description

@ben0x539

example, foo.rs:

#![crate_type = "lib"]
mod inner {
    pub struct Foo {
        pub field: i32
    }
}

pub fn foo() -> inner::Foo {
    inner::Foo { field: 42 }
}

bar.rs:

extern crate foo;

fn main() {
    let f = foo::foo();
    drop(f);
    println!("{}", f.field);
}

foo compiles cleanly, bar doesn't compile because oh no! I've forgotten to make foo::inner::Foo Copyable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions