Skip to content

#[deprecated] incorrectly warns in the same crate if derives are involved #55417

Description

@gnzlbg
#[derive(Debug)]
#[deprecated(since = "0.1.1", note = "oh noes")]
pub struct A;

#[derive(PartialOrd)]
#[deprecated(since = "0.1.1", note = "oh noes")]
pub struct B;

fn main() {}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
warning: use of deprecated item 'A': oh noes
  |
  = note: #[warn(deprecated)] on by default

warning: use of deprecated item 'B': oh noes

error[E0277]: can't compare `B` with `B`
 --> src/main.rs:6:10
  |
6 | #[derive(PartialOrd)]
  |          ^^^^^^^^^^ no implementation for `B == B`
  |
  = help: the trait `std::cmp::PartialEq` is not implemented for `B`

error: aborting due to previous error

An easy fix might be to #[allow(deprecated)] in the custom derive implementations provided by Rust. Right now one has to manually #[allow(deprecated)] on all deprecated structs with derives, which is a pain, and also on all their impls...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions