rust/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
2018-06-19 19:38:37 +02:00

68 lines
3.1 KiB
Plaintext

error[E0596]: cannot borrow immutable item `x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:63:24
|
LL | fn deref_mut_field1(x: Own<Point>) {
| - help: consider changing this to be mutable: `mut x`
LL | let __isize = &mut x.y; //~ ERROR cannot borrow
| ^ cannot borrow as mutable
error[E0596]: cannot borrow immutable item `*x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:75:10
|
LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
| ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
LL | &mut x.y //~ ERROR cannot borrow
| ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error[E0596]: cannot borrow immutable item `x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5
|
LL | fn assign_field1<'a>(x: Own<Point>) {
| - help: consider changing this to be mutable: `mut x`
LL | x.y = 3; //~ ERROR cannot borrow
| ^ cannot borrow as mutable
error[E0596]: cannot borrow immutable item `*x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:102:5
|
LL | fn assign_field2<'a>(x: &'a Own<Point>) {
| -------------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
LL | x.y = 3; //~ ERROR cannot borrow
| ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error[E0596]: cannot borrow immutable item `x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5
|
LL | fn deref_mut_method1(x: Own<Point>) {
| - help: consider changing this to be mutable: `mut x`
LL | x.set(0, 0); //~ ERROR cannot borrow
| ^ cannot borrow as mutable
error[E0596]: cannot borrow immutable item `*x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:131:5
|
LL | fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize {
| ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
LL | x.y_mut() //~ ERROR cannot borrow
| ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error[E0596]: cannot borrow immutable item `x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:139:6
|
LL | fn assign_method1<'a>(x: Own<Point>) {
| - help: consider changing this to be mutable: `mut x`
LL | *x.y_mut() = 3; //~ ERROR cannot borrow
| ^ cannot borrow as mutable
error[E0596]: cannot borrow immutable item `*x` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:143:6
|
LL | fn assign_method2<'a>(x: &'a Own<Point>) {
| -------------- help: consider changing this to be a mutable reference: `&mut Own<Point>`
LL | *x.y_mut() = 3; //~ ERROR cannot borrow
| ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0596`.