2018-07-17 14:29:48 -05:00
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:10:5
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn one_closure(x: i32) {
|
|
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
|
|
LL | ||
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^^^^ cannot assign
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:12:5
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn one_closure(x: i32) {
|
|
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^^^^ cannot assign
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:18:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn two_closures(x: i32) {
|
|
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^^^^ cannot assign
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:22:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn two_closures(x: i32) {
|
|
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^^^^ cannot assign
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:30:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | x = 1;}
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
|
|
|
|
|
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:29:12
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
LL | | x = 1;}
|
|
|
|
| |________________^
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:34:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | x = 1;});
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
|
|
|
|
|
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:33:12
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn_ref(move || {
|
|
|
|
| ____________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
LL | | x = 1;});
|
|
|
|
| |___________^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:42:10
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn two_closures_ref(x: i32) {
|
|
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;}
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^^^^ cannot assign
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:41:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^ cannot borrow as mutable
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;}
|
2018-07-17 14:29:48 -05:00
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
|
|
|
|
|
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:40:12
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | ||
|
|
|
|
LL | | x = 1;}
|
2018-07-17 14:29:48 -05:00
|
|
|
| |________________^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:46:5
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn two_closures_ref(x: i32) {
|
|
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;});
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^^^^ cannot assign
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:45:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^ cannot borrow as mutable
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x = 1;});
|
2018-07-17 14:29:48 -05:00
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
|
|
|
|
|
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:44:12
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn_ref(move || {
|
|
|
|
| ____________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | ||
|
|
|
|
LL | | x = 1;});
|
2018-07-17 14:29:48 -05:00
|
|
|
| |___________^
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:51:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | *x = 1;});
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
|
|
|
|
|
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:50:12
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
LL | | *x = 1;});
|
|
|
|
| |________________^
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:54:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | *x = 1;});
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
|
|
|
|
|
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/closure-captures.rs:53:12
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
|
LL | fn_ref(move || {
|
|
|
|
| ____________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | ||
|
2018-07-17 14:29:48 -05:00
|
|
|
LL | | *x = 1;});
|
|
|
|
| |________________^
|
|
|
|
|
|
|
|
error: aborting due to 12 previous errors
|
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
For more information about this error, try `rustc --explain E0596`.
|