-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
False negative for unused_mut
when writing to field through reference
#110849
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
Comments
rustbot
added
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
labels
Apr 26, 2023
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 28, 2023
…errors fix false negative for `unused_mut` fixes rust-lang#110849 We want to avoid double diagnostics for code like this, but only if an error actually occurs: ```rust fn main() { let mut x: (i32, i32); x.0 = 1; } ``` The first commit fixes the lint and the second one removes all the unused `mut`s it found.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 28, 2023
…errors fix false negative for `unused_mut` fixes rust-lang#110849 We want to avoid double diagnostics for code like this, but only if an error actually occurs: ```rust fn main() { let mut x: (i32, i32); x.0 = 1; } ``` The first commit fixes the lint and the second one removes all the unused `mut`s it found.
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this issue
Apr 30, 2023
fix false negative for `unused_mut` fixes rust-lang/rust#110849 We want to avoid double diagnostics for code like this, but only if an error actually occurs: ```rust fn main() { let mut x: (i32, i32); x.0 = 1; } ``` The first commit fixes the lint and the second one removes all the unused `mut`s it found.
kaivol
added a commit
to kaivol/windows-rs
that referenced
this issue
May 3, 2023
Likely related to rust-lang/rust#110849
kaivol
added a commit
to kaivol/windows-rs
that referenced
this issue
May 3, 2023
Likely related to rust-lang/rust#110849
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
Code
I tried this code:
I expected to see this: The compiler should tell me to remove the
mut
, since it isn't necessary:Instead this happened: The code compiles without a lint.
The lint triggers correctly with an explicit reborrow:
(&mut *x).0 = 1;
Meta
playground 1.71.0-nightly (2023-04-25 458d4da)
@rustbot label A-diagnostics A-lint
The text was updated successfully, but these errors were encountered: