2018-07-17 14:29:48 -05:00
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:7: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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:9: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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:15: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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:19: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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:27:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn_ref(|| {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------ -- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | ||
|
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | x = 1;}
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:31:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn_ref(move || {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------ ------- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | ||
|
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | x = 1;});
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:39: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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:38:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn_ref(|| {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------ -- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | ||
|
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | x = 1;}
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:43: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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:42:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn_ref(move || {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------ ------- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | ||
|
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | x = 1;});
|
|
|
|
| - mutable borrow occurs due to use of `x` in closure
|
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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:48:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn_ref(|| {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------ -- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | ||
|
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | *x = 1;});
|
|
|
|
| -- mutable borrow occurs due to use of `x` in closure
|
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
|
2019-04-07 10:07:36 -05:00
|
|
|
--> $DIR/closure-captures.rs:51:9
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | fn_ref(move || {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ------ ------- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | ||
|
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
LL | *x = 1;});
|
|
|
|
| -- mutable borrow occurs due to use of `x` in closure
|
2018-07-17 14:29:48 -05:00
|
|
|
|
|
|
|
error: aborting due to 12 previous errors
|
|
|
|
|
2019-11-06 06:58:44 -06:00
|
|
|
Some errors have detailed explanations: E0594, E0596.
|
|
|
|
For more information about an error, try `rustc --explain E0594`.
|