-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Confusing warn-unused-mut warnings since 1.27.0-nightly 2018-04-29 #50343
Comments
Bizarre; this must be where all the missing "unused |
A quick bisect run points at #48605 as the cause of this. cc @KiChjang @nikomatsakis |
Just to confirm: this is specific to crates using |
This problem breaks our build. Some examples: error: variable does not need to be mutable
--> src/utils/async_mutex.rs:154:35
|
154 | .map_err(|_| AsyncMutexError::AwakenerCanceled)?
| ^ help: remove this `mut`
...
error: variable does not need to be mutable
--> src/timer.rs:153:19
|
153 | .map(|_| tm.create_client())
| ^ help: remove this `mut`
|
note: lint level defined here
--> src/timer.rs:40:9
|
40 | #![deny(warnings)]
| ^^^^^^^^ |
@realcr Same question as Niko posted above -- does this only happen when you enable NLL? |
In the case of my linked project |
@KiChjang @nikomatsakis as far as I can see this only happens with NLL (or at least, this snippet emits the warning only with NLL enabled):
|
I guess that's a reduced test case? |
@KiChjang : It's the first time I hear about NLL. It seems like my project does have NLL enabled. $ ag "nll"
src/lib.rs
2:#![feature(nll)] Interesting. EDIT: I can't tell if this problem is unique to NLL, because if I remove it the project doesn't compile. Now I know what NLL does (: error[E0597]: `**dur` does not live long enough
--> src/timer.rs:164:40
|
162 | .map(|client| client.take(u64::from(TICKS)).collect().and_then(|_| {
| --- capture occurs here
163 | let elapsed = start.elapsed();
164 | assert!(elapsed >= dur * TICKS * 2 / 3);
| ^^^ borrowed value does not live long enough
...
168 | .collect::<Vec<_>>();
| - borrowed value only lives until here
...
173 | }
| - borrowed value needs to live until here |
Skip checking for unused mutable locals that have no name Fixes #50343.
With the latest nightly (
rustc 1.27.0-nightly (66363b288 2018-04-29)
) I get confusing compile warnings about unusedmut
keywords where there are nomut
keywords present.The warnings do not happen on the previous nightly (
rustc 1.27.0-nightly (66363b288 2018-04-28)
) - so this might be a regression.For further inspection the project where I receive those warnings can be found here.
Some examples
The text was updated successfully, but these errors were encountered: