Skip to content

Commit

Permalink
Update the previously checkpointed (but unused by bors) tests to refl…
Browse files Browse the repository at this point in the history
…ect current reality.
  • Loading branch information
pnkfelix committed Apr 18, 2018
1 parent 02a7809 commit ea45474
Show file tree
Hide file tree
Showing 19 changed files with 174 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/issue-45983.nll.stderr
Expand Up @@ -16,7 +16,7 @@ error[E0594]: cannot assign to immutable item `x`
LL | give_any(|y| x = Some(y));
| ^^^^^^^^^^^ cannot mutate
|
= note: Value not mutable causing this error: `x`
= note: the value which is causing this path not to be mutable is...: `x`

error[E0596]: cannot borrow immutable item `x` as mutable
--> $DIR/issue-45983.rs:17:14
Expand Down
11 changes: 9 additions & 2 deletions src/test/ui/did_you_mean/issue-34126.nll.stderr
@@ -1,3 +1,9 @@
error[E0596]: cannot borrow immutable item `self` as mutable
--> $DIR/issue-34126.rs:16:18
|
LL | self.run(&mut self); //~ ERROR cannot borrow
| ^^^^^^^^^ cannot borrow as mutable

error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable
--> $DIR/issue-34126.rs:16:18
|
Expand All @@ -8,6 +14,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow
| immutable borrow occurs here
| borrow later used here

error: aborting due to previous error
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0502`.
Some errors occurred: E0502, E0596.
For more information about an error, try `rustc --explain E0502`.
2 changes: 1 addition & 1 deletion src/test/ui/did_you_mean/issue-35937.nll.stderr
Expand Up @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `f.v` as mutable
LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow
| ^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `f`
= note: the value which is causing this path not to be mutable is...: `f`

error[E0384]: cannot assign twice to immutable variable `s.x`
--> $DIR/issue-35937.rs:26:5
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/did_you_mean/issue-38147-1.nll.stderr
Expand Up @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*self.s` as mutable
LL | self.s.push('x'); //~ ERROR cannot borrow data mutably
| ^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/did_you_mean/issue-38147-4.nll.stderr
Expand Up @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*f.s` as mutable
LL | f.s.push('x'); //~ ERROR cannot borrow data mutably
| ^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*f`
= note: the value which is causing this path not to be mutable is...: `*f`

error: aborting due to previous error

Expand Down
22 changes: 11 additions & 11 deletions src/test/ui/did_you_mean/issue-39544.nll.stderr
Expand Up @@ -4,87 +4,87 @@ error[E0596]: cannot borrow immutable item `z.x` as mutable
LL | let _ = &mut z.x; //~ ERROR cannot borrow
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `z`
= note: the value which is causing this path not to be mutable is...: `z`

error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:26:17
|
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`

error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:30:17
|
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`

error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:31:17
|
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`

error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:35:17
|
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`

error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:36:17
|
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`

error[E0596]: cannot borrow immutable item `self.x` as mutable
--> $DIR/issue-39544.rs:40:17
|
LL | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*self`
= note: the value which is causing this path not to be mutable is...: `*self`

error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:41:17
|
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`

error[E0596]: cannot borrow immutable item `other.x` as mutable
--> $DIR/issue-39544.rs:45:17
|
LL | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*other`
= note: the value which is causing this path not to be mutable is...: `*other`

error[E0596]: cannot borrow immutable item `z.x` as mutable
--> $DIR/issue-39544.rs:51:13
|
LL | let _ = &mut z.x; //~ ERROR cannot borrow
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `z`
= note: the value which is causing this path not to be mutable is...: `z`

error[E0596]: cannot borrow immutable item `w.x` as mutable
--> $DIR/issue-39544.rs:52:13
|
LL | let _ = &mut w.x; //~ ERROR cannot borrow
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*w`
= note: the value which is causing this path not to be mutable is...: `*w`

error[E0594]: cannot assign to immutable item `*x.0`
--> $DIR/issue-39544.rs:58:5
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/error-codes/E0389.nll.stderr
@@ -1,10 +1,10 @@
error[E0594]: cannot assign to immutable item `fancy_ref.num`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/E0389.rs:18:5
|
LL | let fancy_ref = &(&mut fancy);
| ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
LL | fancy_ref.num = 6; //~ ERROR E0389
| ^^^^^^^^^^^^^^^^^ cannot mutate
|
= note: Value not mutable causing this error: `*fancy_ref`
| ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written

error: aborting due to previous error

Expand Down
46 changes: 46 additions & 0 deletions src/test/ui/hygiene/fields-move.nll.stderr
@@ -0,0 +1,46 @@
error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:38:42
|
LL | $foo.x
| ------ value moved here
...
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ^^^^^ value used here after move
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:28:9
|
LL | $foo.x
| ------ value moved here
...
LL | $foo.x //~ ERROR use of moved value: `foo.x`
| ^^^^^^ value used here after move
...
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ----- value moved here
LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ----------------- in this macro invocation
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `foo.x`
--> $DIR/fields-move.rs:39:42
|
LL | $foo.x
| ------ value moved here
...
LL | $foo.x //~ ERROR use of moved value: `foo.x`
| ------ value moved here
...
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ----- value moved here
LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
| ^^^^^ value used here after move
|
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0382`.
13 changes: 13 additions & 0 deletions src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr
@@ -0,0 +1,13 @@
error: compilation successful
--> $DIR/fields-numeric-borrowck.rs:13:1
|
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
LL | | let mut s = S(0);
LL | | let borrow1 = &mut s.0;
LL | | let S { 0: ref mut borrow2 } = s;
LL | | //~^ ERROR cannot borrow `s.0` as mutable more than once at a time
LL | | }
| |_^

error: aborting due to previous error

4 changes: 2 additions & 2 deletions src/test/ui/hygiene/fields-numeric-borrowck.rs
Expand Up @@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(rustc_attrs)]
struct S(u8);

fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut s = S(0);
let borrow1 = &mut s.0;
let S { 0: ref mut borrow2 } = s;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issue-36400.nll.stderr
Expand Up @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
LL | f(&mut *x); //~ ERROR cannot borrow immutable
| ^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `x`
= note: the value which is causing this path not to be mutable is...: `x`

error: aborting due to previous error

Expand Down
18 changes: 12 additions & 6 deletions src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr
@@ -1,20 +1,26 @@
error[E0594]: cannot assign to immutable item `*x`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/enum.rs:19:5
|
LL | let Wrap(x) = &Wrap(3);
| - help: consider changing this to be a mutable reference: `&mut`
LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^

error[E0594]: cannot assign to immutable item `*x`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/enum.rs:23:9
|
LL | if let Some(x) = &Some(3) {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^

error[E0594]: cannot assign to immutable item `*x`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/enum.rs:29:9
|
LL | while let Some(x) = &Some(3) {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^

error: aborting due to 3 previous errors

Expand Down
18 changes: 12 additions & 6 deletions src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr
@@ -1,20 +1,26 @@
error[E0594]: cannot assign to immutable item `*n`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/explicit-mut.rs:17:13
|
LL | Some(n) => {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^

error[E0594]: cannot assign to immutable item `*n`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/explicit-mut.rs:25:13
|
LL | Some(n) => {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^

error[E0594]: cannot assign to immutable item `*n`
error[E0594]: cannot assign to data in a `&` reference
--> $DIR/explicit-mut.rs:33:13
|
LL | Some(n) => {
| - help: consider changing this to be a mutable reference: `&mut`
LL | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot mutate
| ^^^^^^^

error: aborting due to 3 previous errors

Expand Down
Expand Up @@ -24,7 +24,7 @@ error[E0596]: cannot borrow immutable item `*f.f` as mutable
LL | f.f.call_mut(())
| ^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `*f`
= note: the value which is causing this path not to be mutable is...: `*f`

error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/span/borrowck-object-mutability.nll.stderr
Expand Up @@ -10,7 +10,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
LL | x.borrowed_mut(); //~ ERROR cannot borrow
| ^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `x`
= note: the value which is causing this path not to be mutable is...: `x`

error: aborting due to 2 previous errors

Expand Down
16 changes: 16 additions & 0 deletions src/test/ui/span/destructor-restrictions.nll.stderr
@@ -0,0 +1,16 @@
error[E0597]: `*a` does not live long enough
--> $DIR/destructor-restrictions.rs:18:10
|
LL | *a.borrow() + 1
| ^---------
| |
| borrowed value does not live long enough
| borrow may end up in a temporary, created here
LL | }; //~^ ERROR `*a` does not live long enough
| -- temporary later dropped here, potentially using the reference
| |
| borrowed value only lives until here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
@@ -0,0 +1,30 @@
error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5
|
LL | y.borrow().clone()
| ^---------
| |
| borrowed value does not live long enough
| borrow may end up in a temporary, created here
LL | }
| -
| |
| borrowed value only lives until here
| temporary later dropped here, potentially using the reference

error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9
|
LL | y.borrow().clone()
| ^---------
| |
| borrowed value does not live long enough
| borrow may end up in a temporary, created here
LL | };
| -- temporary later dropped here, potentially using the reference
| |
| borrowed value only lives until here

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0597`.

0 comments on commit ea45474

Please sign in to comment.