Skip to content

Dead code lint trips for publically exported struct variant fields #14837

Closed
@sfackler

Description

@sfackler

This shouldn't trip the lint since the variant is visible outside the crate but it is:

#![feature(struct_variant)]
#![crate_type="lib"]

pub enum Foo {
    Bar {
        pub baz: int
    }
}
~ ❯ rustc test.rs
test.rs:6:13: 6:21 warning: code is never used: `baz`, #[warn(dead_code)] on by default
test.rs:6         pub baz: int
                      ^~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions