Skip to content

Latest nightly compiler reports dead_code warnings for structs with private fields #3740

Closed
@asomers

Description

@asomers

Sometime in the last week the rustc nightly compiler got more aggressive about reporting dead_code warnings. It now warns whenever a struct contains a private field but no constructor. That catches many structs in libc, which are intended to be initialized with std::mem::zeroed(). IMHO this is a rustc bug. This ought to be a separate lint so it can be silenced without silencing all dead_code warnings.

Here's an example build failure:
https://cirrus-ci.com/task/6392171014651904?logs=test#L17

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions