-
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-edition-2018Area: The 2018 editionArea: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalP-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language team
Description
I believe this is a regression in rust2018 nightly (it wasn't triggering in earlier rust2018 builds).
#![deny(warnings)]
#[allow(unreachable_code)]
pub fn sum_nan() {
// return;
let mut v = 0;
assert_eq!(v, 0);
v = 1;
assert_eq!(v, 1);
}
fn main() {}
works correctly, but uncommenting the return;
(play) errors with:
error: variable does not need to be mutable
--> src/main.rs:7:9
|
7 | let mut v = 0;
| ----^
| |
| help: remove this `mut`
This only happens with Rust2018 on nightly (Rust2015 works fine).
mati865
Metadata
Metadata
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-edition-2018Area: The 2018 editionArea: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalP-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language team