Skip to content

derive(Clone, Debug) should not prevent "field is never read" from firing #84647

Closed

Description

struct A { f: () }
#[derive(Clone)]
struct B { f: () }

fn main() {
    let _ = A { f: () };
    let _ = B { f: () };
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ddbb661ad3a117642c4f750b31da4b18

Only A's field triggers the warning. It's clear why B doesn't do this, but it clearly should. Doesn't seem easy to fix though :(

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

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions