if let Some(span) = arg {
err.span_label(span, "change this to accept `FnMut` instead of `Fn`");
err.span_label(func.span, "expects `Fn` instead of `FnMut`");
- if self.infcx.tcx.sess.source_map().is_multiline(self.body.span) {
- err.span_label(self.body.span, "in this closure");
- }
+ err.span_label(self.body.span, "in this closure");
look_at_return = false;
}
}
| - change this to accept `FnMut` instead of `Fn`
...
LL | let _f = to_fn(|| x = 42);
- | ----- ^^^^^^ cannot assign
- | |
+ | ----- -- ^^^^^^ cannot assign
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | let _g = to_fn(|| set(&mut y));
- | ----- ^^^^^^ cannot borrow as mutable
- | |
+ | ----- -- ^^^^^^ cannot borrow as mutable
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | to_fn(|| z = 42);
- | ----- ^^^^^^ cannot assign
- | |
+ | ----- -- ^^^^^^ cannot assign
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | let _f = to_fn(move || x = 42);
- | ----- ^^^^^^ cannot assign
- | |
+ | ----- ------- ^^^^^^ cannot assign
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | let _g = to_fn(move || set(&mut y));
- | ----- ^^^^^^ cannot borrow as mutable
- | |
+ | ----- ------- ^^^^^^ cannot borrow as mutable
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | to_fn(move || z = 42);
- | ----- ^^^^^^ cannot assign
- | |
+ | ----- ------- ^^^^^^ cannot assign
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | let f = make_fn(|| {
- | ------- expects `Fn` instead of `FnMut`
+ | ------- -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | let y = &raw mut x;
| ^^^^^^^^^^ cannot borrow as mutable
| - change this to accept `FnMut` instead of `Fn`
...
LL | let f = make_fn(move || {
- | ------- expects `Fn` instead of `FnMut`
+ | ------- ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | let y = &raw mut x;
| ^^^^^^^^^^ cannot borrow as mutable
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | x = (1,);
| ^^^^^^^^ cannot assign
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | x = (1,);
LL | x.0 = 1;
| ^^^^^^^ cannot assign
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
...
LL | &mut x;
| ^^^^^^ cannot borrow as mutable
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
...
LL | &mut x.0;
| ^^^^^^^^ cannot borrow as mutable
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | x = (1,);
| ^^^^^^^^ cannot assign
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | x = (1,);
LL | x.0 = 1;
| ^^^^^^^ cannot assign
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
...
LL | &mut x;
| ^^^^^^ cannot borrow as mutable
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
...
LL | &mut x.0;
| ^^^^^^^^ cannot borrow as mutable
//~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
//~| NOTE cannot assign
//~| NOTE expects `Fn` instead of `FnMut`
+ //~| NOTE in this closure
}
fn main() {}
| - change this to accept `FnMut` instead of `Fn`
...
LL | bar(move || x = 1);
- | --- ^^^^^ cannot assign
- | |
+ | --- ------- ^^^^^ cannot assign
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error: aborting due to previous error
| - change this to accept `FnMut` instead of `Fn`
...
LL | call_it(|| x.gen_mut());
- | ------- ^^^^^^^^^^^ cannot borrow as mutable
- | |
+ | ------- -- ^^^^^^^^^^^ cannot borrow as mutable
+ | | |
+ | | in this closure
| expects `Fn` instead of `FnMut`
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | call_it(|| {
- | ------- expects `Fn` instead of `FnMut`
+ | ------- -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | call_it(|| x.gen());
LL | call_it(|| x.gen_mut());
| ^^ - mutable borrow occurs due to use of `x` in closure
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | ||
| ^^ cannot borrow as mutable
LL | x = 1;}
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | ||
| ^^ cannot borrow as mutable
LL | x = 1;});
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | ||
| ^^ cannot borrow as mutable
LL | x = 1;}
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | ||
| ^^ cannot borrow as mutable
LL | x = 1;});
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(|| {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | ||
| ^^ cannot borrow as mutable
LL | *x = 1;});
| - change this to accept `FnMut` instead of `Fn`
...
LL | fn_ref(move || {
- | ------ expects `Fn` instead of `FnMut`
+ | ------ ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | ||
| ^^ cannot borrow as mutable
LL | *x = 1;});
| - change this to accept `FnMut` instead of `Fn`
...
LL | let mut f = to_fn(move || {
- | ----- expects `Fn` instead of `FnMut`
+ | ----- ------- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | n += 1;
| ^^^^^^ cannot assign
| - change this to accept `FnMut` instead of `Fn`
...
LL | call(|| {
- | ---- expects `Fn` instead of `FnMut`
+ | ---- -- in this closure
+ | |
+ | expects `Fn` instead of `FnMut`
LL | counter += 1;
| ^^^^^^^^^^^^ cannot assign