summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/mutability-errors.stderr
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/borrowck/mutability-errors.stderr (renamed from src/test/ui/borrowck/mutability-errors.stderr)84
1 files changed, 50 insertions, 34 deletions
diff --git a/src/test/ui/borrowck/mutability-errors.stderr b/tests/ui/borrowck/mutability-errors.stderr
index dd29ae492..d7c602718 100644
--- a/src/test/ui/borrowck/mutability-errors.stderr
+++ b/tests/ui/borrowck/mutability-errors.stderr
@@ -1,37 +1,46 @@
error[E0594]: cannot assign to `*x`, which is behind a `&` reference
--> $DIR/mutability-errors.rs:9:5
|
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
LL | *x = (1,);
| ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | fn named_ref(x: &mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0594]: cannot assign to `x.0`, which is behind a `&` reference
--> $DIR/mutability-errors.rs:10:5
|
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-LL | *x = (1,);
LL | x.0 = 1;
| ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | fn named_ref(x: &mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/mutability-errors.rs:11:5
|
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-...
LL | &mut *x;
| ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | fn named_ref(x: &mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference
--> $DIR/mutability-errors.rs:12:5
|
-LL | fn named_ref(x: &(i32,)) {
- | ------- help: consider changing this to be a mutable reference: `&mut (i32,)`
-...
LL | &mut x.0;
| ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | fn named_ref(x: &mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/mutability-errors.rs:16:5
@@ -60,37 +69,46 @@ LL | &mut f().0;
error[E0594]: cannot assign to `*x`, which is behind a `*const` pointer
--> $DIR/mutability-errors.rs:23:5
|
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
LL | *x = (1,);
| ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable pointer
+ |
+LL | unsafe fn named_ptr(x: *mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0594]: cannot assign to `x.0`, which is behind a `*const` pointer
--> $DIR/mutability-errors.rs:24:5
|
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-LL | *x = (1,);
LL | (*x).0 = 1;
| ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable pointer
+ |
+LL | unsafe fn named_ptr(x: *mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
--> $DIR/mutability-errors.rs:25:5
|
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-...
LL | &mut *x;
| ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
+ |
+help: consider changing this to be a mutable pointer
+ |
+LL | unsafe fn named_ptr(x: *mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer
--> $DIR/mutability-errors.rs:26:5
|
-LL | unsafe fn named_ptr(x: *const (i32,)) {
- | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)`
-...
LL | &mut (*x).0;
| ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
+ |
+help: consider changing this to be a mutable pointer
+ |
+LL | unsafe fn named_ptr(x: *mut (i32,)) {
+ | ~~~~~~~~~~~
error[E0594]: cannot assign to data in a `*const` pointer
--> $DIR/mutability-errors.rs:30:5
@@ -227,21 +245,19 @@ LL | &mut x.0;
| ^^^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
- --> $DIR/mutability-errors.rs:54:5
+ --> $DIR/mutability-errors.rs:53:14
|
LL | fn imm_local(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
-LL | &mut x;
- | ^^^^^^ cannot borrow as mutable
-
-error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
- --> $DIR/mutability-errors.rs:55:5
- |
-LL | fn imm_local(x: (i32,)) {
- | - help: consider changing this to be mutable: `mut x`
+ | ^ not mutable
LL | &mut x;
+ | ------ cannot borrow as mutable
LL | &mut x.0;
- | ^^^^^^^^ cannot borrow as mutable
+ | -------- cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | fn imm_local(mut x: (i32,)) {
+ | +++
error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/mutability-errors.rs:60:9
@@ -339,7 +355,7 @@ error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item
LL | &mut X.0;
| ^^^^^^^^ cannot borrow as mutable
-error: aborting due to 38 previous errors
+error: aborting due to 37 previous errors
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.