Skip to content

Bogus unknown attribute errors in newest nightly #53481

Description

@sfackler

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

Activity

  1. self-assigned this
    on Aug 19, 2018
  2. added
    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
    on Aug 19, 2018
  3. petrochenkov commented on Aug 20, 2018

    @petrochenkov
    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.

  4. petrochenkov commented on Aug 21, 2018

    @petrochenkov
    Contributor

    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 {}
    }
  5. added this to the 1.30 milestone on Aug 21, 2018
  6. tomhoule commented on Aug 21, 2018

    @tomhoule

    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)

  7. petrochenkov commented on Aug 22, 2018

    @petrochenkov
    Contributor

    Fixed in #53587

  8. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 30, 2018
  9. pnkfelix commented on Aug 30, 2018

    @pnkfelix
    Contributor

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

  10. dtolnay commented on Sep 3, 2018

    @dtolnay
    Member

    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
    
  11. petrochenkov commented on Sep 9, 2018

    @petrochenkov
    Contributor

    Fixed in #54086

  12. added a commit that references this issue on Sep 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions