Skip to content

Don't generate warning when deriving on deprecated type #553

@joshlf

Description

@joshlf

While working on this PR, I wrote the following code:

    #[cfg_attr(feature = "zerocopy", derive(FromZeroes, FromBytes, AsBytes))]    
    #[deprecated(                                                                
        since = "0.2.55",                                                        
        note = "Use the `mach2` crate instead",                                  
    )]                                                                           
    pub struct mach_timebase_info {                                              
        pub numer: u32,                                                          
        pub denom: u32,                                                          
    }

Running cargo check --features zerocopy on cargo 1.74.0-nightly (b4ddf95ad 2023-09-18), I get the following warning:

warning: use of deprecated struct `unix::bsd::apple::mach_timebase_info`: Use the `mach2` crate instead
   --> src/unix/bsd/apple/mod.rs:306:16
    |
306 |     pub struct mach_timebase_info {
    |                ^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

Mentoring instructions

Metadata

Metadata

Assignees

No one assigned

    Labels

    experience-mediumThis issue is of medium difficulty, and requires some experiencehelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions