-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace visibility test with reachability test in dead code detection #119552
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hm, my bad it took me some time to figure out why things were compiling on my side but not in the CI. I'll fix all the previously undetected dead code and you can review then. @rustbot author |
3e34b88
to
e6d8c78
Compare
This comment has been minimized.
This comment has been minimized.
e6d8c78
to
4521396
Compare
Some changes occurred in compiler/rustc_codegen_gcc |
4521396
to
549f08f
Compare
This comment has been minimized.
This comment has been minimized.
549f08f
to
73be48a
Compare
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit fb75654 is kinda a 🥷 fix for Clippy and doesn't really belong in this PR. I definitely appreciate the fix, but would prefer to have it in a Clippy PR. What's the motivation in including it in this PR?
src/tools/clippy/tests/ui-toml/needless_raw_string_hashes_one_allowed/clippy.toml
Outdated
Show resolved
Hide resolved
I hesitated and discussed with other contributors to Rust. My issue with having it in a clippy specific PR is that I don't have a good solution to pass the CI in this one. I can delete or mark as |
Ah, was the |
73be48a
to
5be1860
Compare
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
This comment has been minimized.
This comment has been minimized.
Well it seems to finally pass the CI! Didn't expect it to end-up being a +120/-51 PR 😅 Anyway @rustbot review |
@rustbot author I need to find a way to compile src/bootstrap locally with the stage1 compiler to get rid of all errors befors re pushing. |
The dead_code lint was previously eroneously missing this dead code. Since this lint bug has been fixed, the unused field need to be removed or marked as `#[allow(dead_code)]`. Given that this struct is deserialized without #[serde(deny_unknown_fields)] it is ok to simply delete the never read fields.
843e79f
to
7342cc4
Compare
@rustbot review |
@bors r=cjgillot,saethlin |
higher! |
☀️ Test successful - checks-actions |
Finished benchmarking commit (c308726): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 671.121s -> 671.167s (0.01%) |
New in nightly-2024-03-24 from rust-lang/rust#119552. warning: field `b` is never read --> tests/test_error.rs:53:13 | 52 | pub struct A { | - field in this struct 53 | pub b: Vec<B>, | ^ | = note: `A` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` on by default warning: field `0` is never read --> tests/test_error.rs:57:11 | 57 | C(C), | - ^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 57 | C(()), | ~~ warning: field `d` is never read --> tests/test_error.rs:61:13 | 60 | pub struct C { | - field in this struct 61 | pub d: bool, | ^ | = note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: fields `v` and `w` are never read --> tests/test_error.rs:82:13 | 81 | pub struct Basic { | ----- fields in this struct 82 | pub v: bool, | ^ 83 | pub w: bool, | ^ | = note: `Basic` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: field `c` is never read --> tests/test_error.rs:107:13 | 106 | pub struct Wrapper { | ------- field in this struct 107 | pub c: (), | ^ | = note: `Wrapper` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: field `0` is never read --> tests/test_error.rs:160:11 | 160 | V(usize), | - ^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 160 | V(()), | ~~ warning: field `0` is never read --> tests/test_error.rs:212:15 | 212 | Inner(Inner), | ----- ^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 212 | Inner(()), | ~~ warning: field `0` is never read --> tests/test_error.rs:216:17 | 216 | Variant(Vec<usize>), | ------- ^^^^^^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 216 | Variant(()), | ~~ warning: field `0` is never read --> tests/test_error.rs:245:11 | 245 | V(usize), | - ^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 245 | V(()), | ~~ warning: fields `x` and `y` are never read --> tests/test_error.rs:260:13 | 259 | pub struct Struct { | ------ fields in this struct 260 | pub x: usize, | ^ 261 | pub y: usize, | ^ | = note: `Struct` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: field `x` is never read --> tests/test_error.rs:334:13 | 333 | pub struct S { | - field in this struct 334 | pub x: [i32; 1], | ^ | = note: `S` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: field `x` is never read --> tests/test_error.rs:347:13 | 346 | pub struct S { | - field in this struct 347 | pub x: Option<Box<S>>, | ^ | = note: `S` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: fields `0` and `1` are never read --> tests/test_error.rs:359:18 | 359 | pub struct S(pub usize, pub Option<Box<S>>); | - ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ | | | fields in this struct | = note: `S` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields | 359 | pub struct S((), ()); | ~~ ~~ warning: field `0` is never read --> tests/test_error.rs:370:18 | 370 | pub struct S(pub Option<Box<S>>); | - ^^^^^^^^^^^^^^^^^^ | | | field in this struct | = note: `S` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 370 | pub struct S(()); | ~~ warning: field `x` is never read --> tests/test_error.rs:382:13 | 381 | pub struct S { | - field in this struct 382 | pub x: Option<Box<S>>, | ^ | = note: `S` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis warning: fields `0` and `1` are never read --> tests/test_error.rs:394:18 | 394 | pub struct S(pub usize, pub Option<Box<S>>); | - ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ | | | fields in this struct | = note: `S` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields | 394 | pub struct S((), ()); | ~~ ~~
New in nightly-2024-03-24 from rust-lang/rust#119552. warning: field `0` is never read --> tests/test_item.rs:64:37 | 64 | pub struct S<$life>(pub &$life ()); | - ^^^^^^^^^^^^^ | | | field in this struct ... 72 | m!('a); | ------ in this macro invocation | = note: `#[warn(dead_code)]` on by default = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 64 | pub struct S<$life>(()); | ~~
New in nightly-2024-03-24 from rust-lang/rust#119552. warning: field `x` is never read --> tests/regression/issue795.rs:11:15 | 11 | Variant { x: u8 }, | ------- ^ | | | field in this variant | = note: `#[warn(dead_code)]` on by default warning: field `i` is never read --> tests/regression/issue845.rs:63:9 | 61 | pub struct Struct { | ------ field in this struct 62 | #[serde(deserialize_with = "deserialize_integer_or_string")] 63 | pub i: i64, | ^ | = note: `Struct` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
New in nightly-2024-03-24 from rust-lang/rust#119552. warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:10:9 | 8 | Flatten { | ------- fields in this variant 9 | #[serde(flatten)] 10 | nested: Nested, | ^^^^^^ 11 | string: &'static str, | ^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:20:9 | 18 | Flatten { | ------- fields in this variant 19 | #[serde(flatten)] 20 | nested: Nested, | ^^^^^^ 21 | string: &'static str, | ^^^^^^ warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:30:9 | 28 | Flatten { | ------- fields in this variant 29 | #[serde(flatten)] 30 | nested: Nested, | ^^^^^^ 31 | string: &'static str, | ^^^^^^ warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:40:9 | 38 | Flatten { | ------- fields in this variant 39 | #[serde(flatten)] 40 | nested: Nested, | ^^^^^^ 41 | string: &'static str, | ^^^^^^ warning: field `0` is never read --> test_suite/tests/test_gen.rs:690:33 | 690 | Single(#[serde(borrow)] RelObject<'a>), | ------ ^^^^^^^^^^^^^ | | | field in this variant | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 690 | Single(#[serde(borrow)] ()), | ~~ warning: field `0` is never read --> test_suite/tests/test_gen.rs:691:31 | 691 | Many(#[serde(borrow)] Vec<RelObject<'a>>), | ---- ^^^^^^^^^^^^^^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 691 | Many(#[serde(borrow)] ()), | ~~
…r=cjgillot,saethlin Replace visibility test with reachability test in dead code detection Fixes rust-lang#119545 Also included is a fix for an error now flagged by the lint
…r=cjgillot,saethlin Replace visibility test with reachability test in dead code detection Fixes rust-lang#119545 Also included is a fix for an error now flagged by the lint
Fixes #119545
Also included is a fix for an error now flagged by the lint