-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Mark PartialEq
as #[rustc_trivial_field_reads]
#143487
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
Mark PartialEq
as #[rustc_trivial_field_reads]
#143487
Conversation
r? @fee1-dead
rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r?
to explicitly pick a reviewer
The Miri subtree was changed
cc @rust-lang/miri
This comment has been minimized.
This comment has been minimized.
Probably needs a crater run
I'm pretty sure you'd have to bump dead_code
to deny-by-default but only for struct fields (somehow), otherwise it wouldn't get caught by crater (additional warnings don't make a run fail IINM) unless you're only interested in crates that deny/forbid dead_code
.
Some changes occurred in exhaustiveness checking
cc @Nadrieril
This comment has been minimized.
This comment has been minimized.
This seems like another contentious thing. I'd recommend getting some discussion first (see also #134588 (comment)), maybe on T-lang Zulip.
I wouldn't mind if we use an allow-by-default lint for this, but at present it doesn't look like a trivial change. Maybe incorporate to clippy is another option?
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.
cc @rust-lang/rust-analyzer
This comment has been minimized.
This comment has been minimized.
69ccdf5
to
c0a2f46
Compare
The job aarch64-gnu-llvm-19-1
failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
normalized stderr:
warning: field `0` is never read
##[warning] --> $DIR/mutually-recursive-types.rs:16:14
|
LL | Children(Box<List>),
| -------- ^^^^^^^^^
| |
| field in this variant
|
= note: `Tree` has derived impls for the traits `PartialEq` and `Debug`, but these are intentionally ignored during dead code analysis
= 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
|
LL - Children(Box<List>),
LL + Children(()),
|
warning: field `0` is never read
##[warning] --> $DIR/mutually-recursive-types.rs:17:10
|
LL | Leaf(Colour),
| ---- ^^^^^^
| |
| field in this variant
|
= note: `Tree` has derived impls for the traits `PartialEq` and `Debug`, but these are 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
|
LL - Leaf(Colour),
LL + Leaf(()),
|
warning: fields `0` and `1` are never read
##[warning] --> $DIR/mutually-recursive-types.rs:22:10
|
LL | Cons(Box<Tree>, Box<List>),
| ---- ^^^^^^^^^ ^^^^^^^^^
| |
| fields in this variant
|
= note: `List` has derived impls for the traits `PartialEq` and `Debug`, but these are 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
|
LL - Cons(Box<Tree>, Box<List>),
LL + Cons((), ()),
|
warning: fields `0` and `1` are never read
##[warning] --> $DIR/mutually-recursive-types.rs:28:10
|
LL | Kons(isize, Box<SmallList>),
| ---- ^^^^^ ^^^^^^^^^^^^^^
| |
| fields in this variant
|
= note: `SmallList` has derived impls for the traits `PartialEq` and `Debug`, but these are 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
|
LL - Kons(isize, Box<SmallList>),
LL + Kons((), ()),
|
warning: 4 warnings emitted
---
To only update this specific test, also pass `--test-args type/mutually-recursive-types.rs`
error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/type/mutually-recursive-types.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type/mutually-recursive-types/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
warning: field `0` is never read
##[warning] --> /checkout/tests/ui/type/mutually-recursive-types.rs:16:14
|
LL | Children(Box<List>),
| -------- ^^^^^^^^^
| |
| field in this variant
|
= note: `Tree` has derived impls for the traits `PartialEq` and `Debug`, but these are intentionally ignored during dead code analysis
= 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
|
LL - Children(Box<List>),
LL + Children(()),
|
warning: field `0` is never read
##[warning] --> /checkout/tests/ui/type/mutually-recursive-types.rs:17:10
|
LL | Leaf(Colour),
| ---- ^^^^^^
| |
| field in this variant
|
= note: `Tree` has derived impls for the traits `PartialEq` and `Debug`, but these are 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
|
LL - Leaf(Colour),
LL + Leaf(()),
|
warning: fields `0` and `1` are never read
##[warning] --> /checkout/tests/ui/type/mutually-recursive-types.rs:22:10
|
LL | Cons(Box<Tree>, Box<List>),
| ---- ^^^^^^^^^ ^^^^^^^^^
| |
| fields in this variant
|
= note: `List` has derived impls for the traits `PartialEq` and `Debug`, but these are 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
|
LL - Cons(Box<Tree>, Box<List>),
LL + Cons((), ()),
|
warning: fields `0` and `1` are never read
##[warning] --> /checkout/tests/ui/type/mutually-recursive-types.rs:28:10
|
LL | Kons(isize, Box<SmallList>),
| ---- ^^^^^ ^^^^^^^^^^^^^^
| |
| fields in this variant
|
= note: `SmallList` has derived impls for the traits `PartialEq` and `Debug`, but these are 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
|
LL - Kons(isize, Box<SmallList>),
LL + Kons((), ()),
|
warning: 4 warnings emitted
------------------------------------------
☔ The latest upstream changes (presumably #143412) made this pull request unmergeable. Please resolve the merge conflicts.
Uh oh!
There was an error while loading. Please reload this page.
Closes #134588
Probably needs a crater run