rust/src/test/ui/borrowck/mutability-errors.stderr

309 lines
8.9 KiB
Plaintext
Raw Normal View History

error[E0594]: cannot assign to immutable borrowed content `*x`
2018-12-25 08:56:47 -07:00
--> $DIR/mutability-errors.rs:9:5
|
LL | fn named_ref(x: &(i32,)) {
| ------- use `&mut (i32,)` here to make mutable
2019-03-09 15:03:44 +03:00
LL | *x = (1,);
| ^^^^^^^^^ 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
|
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;
| ^^^^^^^ 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
|
LL | fn named_ref(x: &(i32,)) {
| ------- use `&mut (i32,)` here to make mutable
...
2019-03-09 15:03:44 +03:00
LL | &mut *x;
| ^^ 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
|
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;
| ^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | *f() = (1,);
| ^^^^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | f().0 = 1;
| ^^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut *f();
| ^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut f().0;
| ^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | *x = (1,);
| ^^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | (*x).0 = 1;
| ^^^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut *x;
| ^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut (*x).0;
| ^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | *f() = (1,);
| ^^^^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | (*f()).0 = 1;
| ^^^^^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut *f();
| ^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut (*f()).0;
| ^^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | x = (1,);
| ^^^^^^^^
|
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
|
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;
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
|
2019-03-09 15:03:44 +03:00
LL | x.0 = 1;
| ^^^^^^^
|
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
|
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;
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
|
2019-03-09 15:03:44 +03:00
LL | &mut x;
| ^
|
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
|
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;
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
|
2019-03-09 15:03:44 +03:00
LL | &mut x.0;
| ^^^
|
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
|
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;
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
|
2019-03-09 15:03:44 +03:00
LL | x = (1,);
| ^^^^^^^^
|
= 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
|
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;
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
|
2019-03-09 15:03:44 +03:00
LL | x.0 = 1;
| ^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut x;
| ^
|
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
|
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;
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
|
2019-03-09 15:03:44 +03:00
LL | &mut x.0;
| ^^^ 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
|
LL | fn imm_local(x: (i32,)) {
| - help: make this binding mutable: `mut x`
2019-03-09 15:03:44 +03:00
LL | &mut x;
| ^ 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
|
LL | fn imm_local(x: (i32,)) {
| - help: make this binding mutable: `mut x`
2019-03-09 15:03:44 +03:00
LL | &mut x;
LL | &mut x.0;
| ^^^ 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
|
LL | fn imm_capture(x: (i32,)) {
| - help: make this binding mutable: `mut x`
2019-03-09 15:03:44 +03:00
LL | || {
| ^^ 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
|
LL | fn imm_capture(x: (i32,)) {
| - help: consider making `x` mutable: `mut x`
...
2019-03-09 15:03:44 +03:00
LL | x = (1,);
| ^^^^^^^^
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
|
2019-03-09 15:03:44 +03:00
LL | x.0 = 1;
| ^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut x;
| ^
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
|
2019-03-09 15:03:44 +03:00
LL | &mut x.0;
| ^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | X = (1,);
| ^^^^^^^^
error[E0594]: cannot assign to field of immutable binding
2018-12-25 08:56:47 -07:00
--> $DIR/mutability-errors.rs:77:5
|
2019-03-09 15:03:44 +03:00
LL | X.0 = 1;
| ^^^^^^^ 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
|
2019-03-09 15:03:44 +03:00
LL | &mut X;
| ^
error[E0596]: cannot borrow field of immutable binding as mutable
2018-12-25 08:56:47 -07:00
--> $DIR/mutability-errors.rs:79:10
|
2019-03-09 15:03:44 +03:00
LL | &mut X.0;
| ^^^ cannot mutably borrow field of immutable binding
error: aborting due to 35 previous errors
Some errors have detailed explanations: E0387, E0595, E0596.
For more information about an error, try `rustc --explain E0387`.