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

Bogus unknown attribute errors in newest nightly #53481

Closed
sfackler opened this issue Aug 19, 2018 · 7 comments · Fixed by #54086
Closed

Bogus unknown attribute errors in newest nightly #53481

sfackler opened this issue Aug 19, 2018 · 7 comments · Fixed by #54086
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name resolution P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@sfackler
Copy link
Member

log4rs no longer builds on nightly with bogus unknown attribute errors:

 ❯ cargo +nightly build                                                                                                                                                                                                                                             [log4rs/master=]
   Compiling log4rs v0.8.0 (file:///home/sfackler/rust/log4rs)                                                                                                                                                                                                                      
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/file.rs:25:1                                                                                                                                                                                                                                                      
   |                                                                                                                                                                                                                                                                               
25 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/console.rs:24:1                                                                                                                                                                                                                                                   
   |                                                                                                                                                                                                                                                                               
24 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/rolling_file/policy/compound/roll/delete.rs:16:1                                                                                                                                                                                                                  
   |                                                                                                                                                                                                                                                                               
16 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/rolling_file/policy/compound/roll/fixed_window.rs:17:1                                                                                                                                                                                                            
   |                                                                                                                                                                                                                                                                               
17 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/rolling_file/policy/compound/trigger/size.rs:21:1                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
21 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/rolling_file/policy/compound/mod.rs:24:1                                                                                                                                                                                                                          
   |                                                                                                                                                                                                                                                                               
24 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)                                                                                                                                         
  --> src/append/rolling_file/mod.rs:46:1                                                                                                                                                                                                                                          
   |                                                                                                                                                                                                                                                                               
46 | #[serde(deny_unknown_fields)]                                                                                                                                                                                                                                                 
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                 
   |                                                                                                                                                                                                                                                                               
   = help: add #![feature(custom_attribute)] to the crate attributes to enable                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                   
error: aborting due to 7 previous errors                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                   
For more information about this error, try `rustc --explain E0658`.                                                                                                                                                                                                                
error: Could not compile `log4rs`.                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                   
To learn more, run the command again with --verbose.

Those attributes are used on types with #[derive(Deserialize)] so the serde attribute should be whitelisted: https://github.com/sfackler/log4rs/blob/master/src/append/file.rs#L22-L30

estk/log4rs#75

@petrochenkov petrochenkov self-assigned this Aug 19, 2018
@petrochenkov petrochenkov added A-resolve Area: Name resolution A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Aug 19, 2018
@petrochenkov
Copy link
Contributor

Unfortunately, feature gate errors are fatal (this needs to be fixed), so in this case they hide the true issue:

error: cannot determine resolution for the derive macro `Deserialize`
  --> src/append/file.rs:24:10
   |
24 | #[derive(Deserialize)]
   |          ^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

All in all, this happens due to #[derive(Deserialize)] being in the same scope with use file::Deserialize;, but I'm not yet sure about details.
I'll try to minimize the issue and find out why resolution is stuck.

The workaround is to avoid use file::Deserialize; imports and to use ::file::Deserialize explicitly.

@petrochenkov
Copy link
Contributor

petrochenkov commented Aug 21, 2018

Minimized:

#[macro_use]
extern crate serde_derive;

mod m1 {
    use m2::Deserialize;

    #[derive(Deserialize)] //~ ERROR cannot determine resolution for the derive macro `Deserialize`
    struct A {}
}

mod m2 {
    pub type Deserialize = u8;

    #[derive(Deserialize)]
    #[serde]
    struct B {}
}

@alexcrichton alexcrichton added this to the 1.30 milestone Aug 21, 2018
@tomhoule
Copy link

tomhoule commented Aug 21, 2018

I believe my project is hitting a similar issue: see the travis CI runs for this PR: graphql-rust/graphql-client#79

error: cannot determine resolution for the attribute macro `serde`
  --> tests/subscriptions.rs:19:10
   |
19 | #[derive(GraphQLQuery)]
   |          ^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

(happens only on nightly)

@petrochenkov
Copy link
Contributor

Fixed in #53587

@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 30, 2018
@pnkfelix
Copy link
Member

visiting for triage. P-high. (Hopefully the aforementioned PR will land before next week's meeting.)

@dtolnay
Copy link
Member

dtolnay commented Sep 3, 2018

For those looking for a nightly to use, nightly-2018-08-17 is the newest that does not hit this issue.

rustup install nightly-2018-08-17

TedDriggs added a commit to colin-kiegel/rust-derive-builder that referenced this issue Sep 4, 2018
@petrochenkov
Copy link
Contributor

Fixed in #54086

bors added a commit that referenced this issue Sep 13, 2018
resolve: Future proof derive helper attributes

Derive helpers no longer require going through recovery mode (fixes #53481).
They also report an error if they are ambiguous with any other macro in scope, so we can resolve the question about their exact priority sometime later (cc #52226).
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, ..) A-resolve Area: Name resolution P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants