Skip to content

Custom attr on module causes macro import to be unresolved #65935

Closed
@TheDan64

Description

@TheDan64
#![feature(custom_attribute)]

#[my_header = "foo.c"]
pub mod foo {
    use c2rust_bitfields::BitfieldStruct;

    #[derive(BitfieldStruct)]
    struct Foo {
    }
}

will fail to compile with

error: cannot determine resolution for the derive macro `BitfieldStruct`
 --> src/main.rs:7:14
  |
7 |     #[derive(BitfieldStruct)]
  |              ^^^^^^^^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: aborting due to previous error

However, removing the my_header attr will let it compile again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions