Skip to content

Commit ea45474

Browse files
committed
Update the previously checkpointed (but unused by bors) tests to reflect current reality.
1 parent 02a7809 commit ea45474

19 files changed

+174
-50
lines changed

src/test/ui/borrowck/issue-45983.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0594]: cannot assign to immutable item `x`
1616
LL | give_any(|y| x = Some(y));
1717
| ^^^^^^^^^^^ cannot mutate
1818
|
19-
= note: Value not mutable causing this error: `x`
19+
= note: the value which is causing this path not to be mutable is...: `x`
2020

2121
error[E0596]: cannot borrow immutable item `x` as mutable
2222
--> $DIR/issue-45983.rs:17:14

src/test/ui/did_you_mean/issue-34126.nll.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
error[E0596]: cannot borrow immutable item `self` as mutable
2+
--> $DIR/issue-34126.rs:16:18
3+
|
4+
LL | self.run(&mut self); //~ ERROR cannot borrow
5+
| ^^^^^^^^^ cannot borrow as mutable
6+
17
error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable
28
--> $DIR/issue-34126.rs:16:18
39
|
@@ -8,6 +14,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow
814
| immutable borrow occurs here
915
| borrow later used here
1016

11-
error: aborting due to previous error
17+
error: aborting due to 2 previous errors
1218

13-
For more information about this error, try `rustc --explain E0502`.
19+
Some errors occurred: E0502, E0596.
20+
For more information about an error, try `rustc --explain E0502`.

src/test/ui/did_you_mean/issue-35937.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `f.v` as mutable
44
LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow
55
| ^^^ cannot borrow as mutable
66
|
7-
= note: Value not mutable causing this error: `f`
7+
= note: the value which is causing this path not to be mutable is...: `f`
88

99
error[E0384]: cannot assign twice to immutable variable `s.x`
1010
--> $DIR/issue-35937.rs:26:5

src/test/ui/did_you_mean/issue-38147-1.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*self.s` as mutable
44
LL | self.s.push('x'); //~ ERROR cannot borrow data mutably
55
| ^^^^^^ cannot borrow as mutable
66
|
7-
= note: Value not mutable causing this error: `*self`
7+
= note: the value which is causing this path not to be mutable is...: `*self`
88

99
error: aborting due to previous error
1010

src/test/ui/did_you_mean/issue-38147-4.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*f.s` as mutable
44
LL | f.s.push('x'); //~ ERROR cannot borrow data mutably
55
| ^^^ cannot borrow as mutable
66
|
7-
= note: Value not mutable causing this error: `*f`
7+
= note: the value which is causing this path not to be mutable is...: `*f`
88

99
error: aborting due to previous error
1010

src/test/ui/did_you_mean/issue-39544.nll.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,87 +4,87 @@ error[E0596]: cannot borrow immutable item `z.x` as mutable
44
LL | let _ = &mut z.x; //~ ERROR cannot borrow
55
| ^^^^^^^^ cannot borrow as mutable
66
|
7-
= note: Value not mutable causing this error: `z`
7+
= note: the value which is causing this path not to be mutable is...: `z`
88

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

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

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

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

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

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

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

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

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

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

8989
error[E0594]: cannot assign to immutable item `*x.0`
9090
--> $DIR/issue-39544.rs:58:5

src/test/ui/error-codes/E0389.nll.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0594]: cannot assign to immutable item `fancy_ref.num`
1+
error[E0594]: cannot assign to data in a `&` reference
22
--> $DIR/E0389.rs:18:5
33
|
4+
LL | let fancy_ref = &(&mut fancy);
5+
| ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
46
LL | fancy_ref.num = 6; //~ ERROR E0389
5-
| ^^^^^^^^^^^^^^^^^ cannot mutate
6-
|
7-
= note: Value not mutable causing this error: `*fancy_ref`
7+
| ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written
88

99
error: aborting due to previous error
1010

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error[E0382]: use of moved value: `foo.x`
2+
--> $DIR/fields-move.rs:38:42
3+
|
4+
LL | $foo.x
5+
| ------ value moved here
6+
...
7+
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
8+
| ^^^^^ value used here after move
9+
|
10+
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
11+
12+
error[E0382]: use of moved value: `foo.x`
13+
--> $DIR/fields-move.rs:28:9
14+
|
15+
LL | $foo.x
16+
| ------ value moved here
17+
...
18+
LL | $foo.x //~ ERROR use of moved value: `foo.x`
19+
| ^^^^^^ value used here after move
20+
...
21+
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
22+
| ----- value moved here
23+
LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
24+
| ----------------- in this macro invocation
25+
|
26+
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
27+
28+
error[E0382]: use of moved value: `foo.x`
29+
--> $DIR/fields-move.rs:39:42
30+
|
31+
LL | $foo.x
32+
| ------ value moved here
33+
...
34+
LL | $foo.x //~ ERROR use of moved value: `foo.x`
35+
| ------ value moved here
36+
...
37+
LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
38+
| ----- value moved here
39+
LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
40+
| ^^^^^ value used here after move
41+
|
42+
= note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
43+
44+
error: aborting due to 3 previous errors
45+
46+
For more information about this error, try `rustc --explain E0382`.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: compilation successful
2+
--> $DIR/fields-numeric-borrowck.rs:13:1
3+
|
4+
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
5+
LL | | let mut s = S(0);
6+
LL | | let borrow1 = &mut s.0;
7+
LL | | let S { 0: ref mut borrow2 } = s;
8+
LL | | //~^ ERROR cannot borrow `s.0` as mutable more than once at a time
9+
LL | | }
10+
| |_^
11+
12+
error: aborting due to previous error
13+

src/test/ui/hygiene/fields-numeric-borrowck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
10+
#![feature(rustc_attrs)]
1111
struct S(u8);
1212

13-
fn main() {
13+
fn main() { #![rustc_error] // rust-lang/rust#49855
1414
let mut s = S(0);
1515
let borrow1 = &mut s.0;
1616
let S { 0: ref mut borrow2 } = s;

src/test/ui/issue-36400.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
44
LL | f(&mut *x); //~ ERROR cannot borrow immutable
55
| ^^^^^^^ cannot borrow as mutable
66
|
7-
= note: Value not mutable causing this error: `x`
7+
= note: the value which is causing this path not to be mutable is...: `x`
88

99
error: aborting due to previous error
1010

src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
error[E0594]: cannot assign to immutable item `*x`
1+
error[E0594]: cannot assign to data in a `&` reference
22
--> $DIR/enum.rs:19:5
33
|
4+
LL | let Wrap(x) = &Wrap(3);
5+
| - help: consider changing this to be a mutable reference: `&mut`
46
LL | *x += 1; //~ ERROR cannot assign to immutable
5-
| ^^^^^^^ cannot mutate
7+
| ^^^^^^^
68

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

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

1925
error: aborting due to 3 previous errors
2026

src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
error[E0594]: cannot assign to immutable item `*n`
1+
error[E0594]: cannot assign to data in a `&` reference
22
--> $DIR/explicit-mut.rs:17:13
33
|
4+
LL | Some(n) => {
5+
| - help: consider changing this to be a mutable reference: `&mut`
46
LL | *n += 1; //~ ERROR cannot assign to immutable
5-
| ^^^^^^^ cannot mutate
7+
| ^^^^^^^
68

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

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

1925
error: aborting due to 3 previous errors
2026

src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ error[E0596]: cannot borrow immutable item `*f.f` as mutable
2424
LL | f.f.call_mut(())
2525
| ^^^ cannot borrow as mutable
2626
|
27-
= note: Value not mutable causing this error: `*f`
27+
= note: the value which is causing this path not to be mutable is...: `*f`
2828

2929
error[E0507]: cannot move out of borrowed content
3030
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13

src/test/ui/span/borrowck-object-mutability.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0596]: cannot borrow immutable item `*x` as mutable
1010
LL | x.borrowed_mut(); //~ ERROR cannot borrow
1111
| ^ cannot borrow as mutable
1212
|
13-
= note: Value not mutable causing this error: `x`
13+
= note: the value which is causing this path not to be mutable is...: `x`
1414

1515
error: aborting due to 2 previous errors
1616

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0597]: `*a` does not live long enough
2+
--> $DIR/destructor-restrictions.rs:18:10
3+
|
4+
LL | *a.borrow() + 1
5+
| ^---------
6+
| |
7+
| borrowed value does not live long enough
8+
| borrow may end up in a temporary, created here
9+
LL | }; //~^ ERROR `*a` does not live long enough
10+
| -- temporary later dropped here, potentially using the reference
11+
| |
12+
| borrowed value only lives until here
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0597`.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0597]: `y` does not live long enough
2+
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5
3+
|
4+
LL | y.borrow().clone()
5+
| ^---------
6+
| |
7+
| borrowed value does not live long enough
8+
| borrow may end up in a temporary, created here
9+
LL | }
10+
| -
11+
| |
12+
| borrowed value only lives until here
13+
| temporary later dropped here, potentially using the reference
14+
15+
error[E0597]: `y` does not live long enough
16+
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9
17+
|
18+
LL | y.borrow().clone()
19+
| ^---------
20+
| |
21+
| borrowed value does not live long enough
22+
| borrow may end up in a temporary, created here
23+
LL | };
24+
| -- temporary later dropped here, potentially using the reference
25+
| |
26+
| borrowed value only lives until here
27+
28+
error: aborting due to 2 previous errors
29+
30+
For more information about this error, try `rustc --explain E0597`.

0 commit comments

Comments
 (0)