-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[NLL] mutability difference #50897
Labels
A-NLL
Area: Non-lexical lifetimes (NLL)
Comments
Here's a smaller repro reduced from code that uses futures-await's async proc macro. #![feature(generators, nll)]
struct Config;
impl Config { fn foo(&mut self) { } }
fn foo(mut c: Config) {
let _g = move || {
if false {
yield ();
}
c.foo();
};
}
fn main() {
foo(Config);
} raises |
This was referenced Jun 26, 2018
Tagging as NLL-deferred because #51918 has precedence |
bors
added a commit
that referenced
this issue
Jul 5, 2018
…omatsakis [NLL] Fix various unused mut errors Closes #51801 Closes #50897 Closes #51830 Closes #51904 cc #51918 - keeping this one open in case there are any more issues This PR contains multiple changes. List of changes with examples of what they fix: * Change mir generation so that the parameter variable doesn't get a name when a `ref` pattern is used as an argument ```rust fn f(ref y: i32) {} // doesn't trigger lint ``` * Change mir generation so that by-move closure captures don't get first moved into a temporary. ```rust let mut x = 0; // doesn't trigger lint move || { x = 1; }; ``` * Treat generator upvars the same as closure upvars ```rust let mut x = 0; // This mut is now necessary and is not linted against. move || { x = 1; yield; }; ``` r? @nikomatsakis
Arnavion
pushed a commit
to Arnavion/fac-rs
that referenced
this issue
Jul 7, 2018
rust-lang/rust#50897 is fixed now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gives a warning:
If I remove the "mut" that warning goes away and the program runs correctly.
But if I comment out the feature(nll) line (without the "mut" in foo signature) it gives:
The text was updated successfully, but these errors were encountered: