Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TheDan64 opened this issue Oct 29, 2019 · 3 comments
Closed

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

TheDan64 opened this issue Oct 29, 2019 · 3 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TheDan64
Copy link
Contributor

#![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.

@Mark-Simulacrum
Copy link
Member

cc @petrochenkov

Hm, the custom attribute feature might be at fault here, I suspect you want to make the custom attribute a normal macro (perhaps one that expands to a constant or something, not sure what the use case here is exactly). But this is total guesswork.

@Mark-Simulacrum Mark-Simulacrum added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 29, 2019
@petrochenkov
Copy link
Contributor

#![feature(custom_attribute)] is not supported and slated for removal (with #57921 (comment) being the expected replacement), so I'd close this as wontfix.

@Mark-Simulacrum
Copy link
Member

That sounds reasonable. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants