Skip to content

include! does not expand derive behind #[cfg_attr] #32957

Closed
@alexcrichton

Description

@alexcrichton

For example.this does not compile:

// bar.rs
#[cfg_attr(foo, derive(Clone))]
struct A(u32);

// foo.rs
include!("bar.rs");
fn main() {
    A(1).clone();
}

Compiled with rustc --cfg foo foo.rs this will fail with A not implementing Clone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions