Skip to content

Derives on deprecated enum variants generate deprecation warnings #92313

Open
@Gerhut

Description

@Gerhut

I tried this code:

use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
enum Point {
    #[deprecated]
    TwoD(i32, i32),
    ThreeD(i32, i32, i32),
}

fn main() {
    println!("Hello, world!");
}

I expected to see this happen: explanation

No deprecated warnings generated.

Instead, this happened: explanation

use of deprecated tuple variant Point::TwoD
#[warn(deprecated)] on by default

Meta

rustc --version --verbose:

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

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.L-deprecatedLint: deprecatedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions