2018-07-17 20:29:48 +01:00
|
|
|
error[E0594]: cannot assign to immutable borrowed content `*x`
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:9:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn named_ref(x: &(i32,)) {
|
|
|
|
| ------- use `&mut (i32,)` here to make mutable
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | *x = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field `x.0` of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:10:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn named_ref(x: &(i32,)) {
|
|
|
|
| ------- use `&mut (i32,)` here to make mutable
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | *x = (1,);
|
|
|
|
LL | x.0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:11:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn named_ref(x: &(i32,)) {
|
|
|
|
| ------- use `&mut (i32,)` here to make mutable
|
|
|
|
...
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut *x;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:12:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn named_ref(x: &(i32,)) {
|
|
|
|
| ------- use `&mut (i32,)` here to make mutable
|
|
|
|
...
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to immutable borrowed content
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:16:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | *f() = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:17:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | f().0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable borrowed content as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:18:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut *f();
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:19:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut f().0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to immutable dereference of raw pointer `*x`
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:23:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | *x = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field `x.0` of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:24:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | (*x).0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable dereference of raw pointer `*x` as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:25:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut *x;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:26:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut (*x).0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to immutable dereference of raw pointer
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:30:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | *f() = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:31:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | (*f()).0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable dereference of raw pointer as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:32:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut *f();
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:33:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut (*f()).0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:40:9
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:39:12
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | | x = (1,);
|
|
|
|
LL | | x.0 = 1;
|
|
|
|
LL | | &mut x;
|
|
|
|
LL | | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:41:9
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x.0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:39:12
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | | x = (1,);
|
|
|
|
LL | | x.0 = 1;
|
|
|
|
LL | | &mut x;
|
|
|
|
LL | | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:42:14
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:39:12
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | | x = (1,);
|
|
|
|
LL | | x.0 = 1;
|
|
|
|
LL | | &mut x;
|
|
|
|
LL | | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:43:14
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^
|
|
|
|
|
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:39:12
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn_ref(|| {
|
|
|
|
| ____________^
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | | x = (1,);
|
|
|
|
LL | | x.0 = 1;
|
|
|
|
LL | | &mut x;
|
|
|
|
LL | | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to captured outer variable in an `Fn` closure
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:46:9
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `Fn` closures cannot capture their enclosing environment for modifications
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:45:12
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn_ref(move || {
|
|
|
|
| ____________^
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | | x = (1,);
|
|
|
|
LL | | x.0 = 1;
|
|
|
|
LL | | &mut x;
|
|
|
|
LL | | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field `x.0` of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:47:9
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x.0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:48:14
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:45:12
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn_ref(move || {
|
|
|
|
| ____________^
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | | x = (1,);
|
|
|
|
LL | | x.0 = 1;
|
|
|
|
LL | | &mut x;
|
|
|
|
LL | | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:49:14
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable argument `x` as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:54:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn imm_local(x: (i32,)) {
|
2018-09-12 14:13:40 -04:00
|
|
|
| - help: make this binding mutable: `mut x`
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^ cannot borrow mutably
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:55:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn imm_local(x: (i32,)) {
|
2018-09-12 14:13:40 -04:00
|
|
|
| - help: make this binding mutable: `mut x`
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x;
|
|
|
|
LL | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0595]: closure cannot assign to immutable argument `x`
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:59:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn imm_capture(x: (i32,)) {
|
2018-09-12 14:13:40 -04:00
|
|
|
| - help: make this binding mutable: `mut x`
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | || {
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^ cannot borrow mutably
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:66:9
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
|
|
|
LL | fn imm_capture(x: (i32,)) {
|
|
|
|
| - help: consider making `x` mutable: `mut x`
|
|
|
|
...
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field `x.0` of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:67:9
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | x.0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:68:14
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field `x.0` of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:69:14
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut x.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to immutable static item
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:76:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | X = (1,);
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to field of immutable binding
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:77:5
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | X.0 = 1;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable static item as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:78:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut X;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/mutability-errors.rs:79:10
|
2018-07-17 20:29:48 +01:00
|
|
|
|
|
2019-03-09 15:03:44 +03:00
|
|
|
LL | &mut X.0;
|
2018-07-17 20:29:48 +01:00
|
|
|
| ^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error: aborting due to 35 previous errors
|
|
|
|
|
2019-04-17 13:26:38 -04:00
|
|
|
Some errors have detailed explanations: E0387, E0595, E0596.
|
2018-07-17 20:29:48 +01:00
|
|
|
For more information about an error, try `rustc --explain E0387`.
|