Mark variables captured by reference as mutable correctly
This commit is contained in:
parent
f8673e0ad8
commit
968ea1ce32
2 changed files with 87 additions and 28 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// extra unused mut lint tests for #51918
|
||||
|
||||
// run-pass
|
||||
// compile-pass
|
||||
|
||||
#![feature(generators, nll)]
|
||||
#![deny(unused_mut)]
|
||||
|
|
@ -53,11 +53,14 @@ fn if_guard(x: Result<i32, i32>) {
|
|||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
ref_argument(0);
|
||||
mutable_upvar();
|
||||
generator_mutable_upvar();
|
||||
ref_closure_argument();
|
||||
parse_dot_or_call_expr_with(Vec::new());
|
||||
if_guard(Ok(0));
|
||||
// #59620
|
||||
fn nested_closures() {
|
||||
let mut i = 0;
|
||||
[].iter().for_each(|_: &i32| {
|
||||
[].iter().for_each(move |_: &i32| {
|
||||
i += 1;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue