-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsNLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goal
Milestone
Description
Consider the following code (play):
#![feature(nll)]
#![allow(unreachable_code)]
fn main() {
for _ in { return (); 0..3 } {
}
}
It signals the following diagnostic:
warning: variable does not need to be mutable
--> src/main.rs:5:14
|
5 | for _ in { return (); 0..3 } {
| --^^^^^^^^^^^^^^^^^
| |
| help: remove this `mut`
|
= note: #[warn(unused_mut)] on by default
Which is pretty nonsensical in appearance.
(It almost certainly arises due to a legitimate mut
appeared in the expansion of for
. We probably just need to check whether a mut
that has been introduced is due to legitimate source code or if its due to an internal expansion, and use that knowledge when we decide whether to signal the unused_mut
lint.)
Metadata
Metadata
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsNLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goal