rust/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr

77 lines
3.1 KiB
Plaintext
Raw Normal View History

error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:15:27
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _f = to_fn(|| x = 42);
| ^^^^^^ cannot assign
2018-08-08 14:28:26 +02:00
|
help: consider changing this to accept closures that implement `FnMut`
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:15:24
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _f = to_fn(|| x = 42);
2018-08-08 14:28:26 +02:00
| ^^^^^^^^^
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
--> $DIR/borrow-immutable-upvar-mutation.rs:18:31
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _g = to_fn(|| set(&mut y));
| ^^^^^^ cannot borrow as mutable
2018-08-08 14:28:26 +02:00
|
help: consider changing this to accept closures that implement `FnMut`
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:18:24
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _g = to_fn(|| set(&mut y));
2018-08-08 14:28:26 +02:00
| ^^^^^^^^^^^^^^
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:21:55
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
| ^^^^^^ cannot assign
2018-08-08 14:28:26 +02:00
|
help: consider changing this to accept closures that implement `FnMut`
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:21:52
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); });
2018-08-08 14:28:26 +02:00
| ^^^^^^^^^
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:27:32
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _f = to_fn(move || x = 42);
| ^^^^^^ cannot assign
2018-08-08 14:28:26 +02:00
|
help: consider changing this to accept closures that implement `FnMut`
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:27:24
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _f = to_fn(move || x = 42);
2018-08-08 14:28:26 +02:00
| ^^^^^^^^^^^^^^
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
--> $DIR/borrow-immutable-upvar-mutation.rs:30:36
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _g = to_fn(move || set(&mut y));
| ^^^^^^ cannot borrow as mutable
2018-08-08 14:28:26 +02:00
|
help: consider changing this to accept closures that implement `FnMut`
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:30:24
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _g = to_fn(move || set(&mut y));
2018-08-08 14:28:26 +02:00
| ^^^^^^^^^^^^^^^^^^^
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:33:65
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
| ^^^^^^ cannot assign
2018-08-08 14:28:26 +02:00
|
help: consider changing this to accept closures that implement `FnMut`
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-immutable-upvar-mutation.rs:33:57
2018-08-08 14:28:26 +02:00
|
2019-03-09 15:03:44 +03:00
LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); });
2018-08-08 14:28:26 +02:00
| ^^^^^^^^^^^^^^
error: aborting due to 6 previous errors
2019-11-06 13:58:44 +01:00
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.