Closed
Description
The latest nightly (rustc 1.57.0-nightly (8c2b6ea 2021-09-11)) introduces a new warning that I consider to be invalid.
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=14d790d2f286f58543c42d915f60e182
#[derive(Debug)]
struct Foo {
a: String,
}
fn main() {
let foo = Foo {
a: "hello".to_string(),
};
println!("{:?}", foo);
}
The current output is:
warning: field is never read: `a`
--> src/main.rs:3:5
|
3 | a: String,
| ^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `playground` (bin "playground") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 1.56s
This feels very wrong to me. It means any struct created with the intent to be printed is "invalid" according to the compiler. This warning is not actionable. My only option is to suppress it, live with it, or insert some sort of "dummy read". This has broken our CI builds for Bevy (because we treat warnings as errors).