Skip to content

Report fields which are never read as dead. #13426

Description

@eddyb

Dead code analysis finds unused types and functions, but doesn't look at struct fields.

struct Foo {
    bar: A,
    baz: B
}
fn foo() {
    let foo = Foo {bar: a, baz: b};
    foo.bar.do_something();
    // Never read foo.baz again. Compiler doesn't complain.
}

This could also be applied to tuple structs and enum variants.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions