Skip to content

Commit b10beb3

Browse files
committed
updates to existing ui/borrowck tests.
1 parent 4229739 commit b10beb3

21 files changed

+137
-142
lines changed
+11-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
error[E0381]: use of possibly uninitialized variable: `x`
2-
--> $DIR/assign_mutable_fields.rs:29:10
1+
error[E0381]: assign to part of possibly uninitialized variable: `x`
2+
--> $DIR/assign_mutable_fields.rs:19:5
33
|
4-
LL | drop(x); //~ ERROR
5-
| ^ use of possibly uninitialized `x`
4+
LL | x.0 = 1;
5+
| ^^^^^^^ use of possibly uninitialized `x`
66

7-
error: aborting due to previous error
7+
error[E0381]: assign to part of possibly uninitialized variable: `x`
8+
--> $DIR/assign_mutable_fields.rs:27:5
9+
|
10+
LL | x.0 = 1;
11+
| ^^^^^^^ use of possibly uninitialized `x`
12+
13+
error: aborting due to 2 previous errors
814

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

Diff for: src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0382]: use of moved value: `*x.b`
1+
error[E0382]: use of moved value: `x.b`
22
--> $DIR/borrowck-field-sensitivity.rs:18:10
33
|
44
LL | drop(x.b);
55
| --- value moved here
66
LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
77
| ^^^^ value used here after move
88

9-
error[E0382]: use of moved value: `*x.b`
9+
error[E0382]: use of moved value: `x.b`
1010
--> $DIR/borrowck-field-sensitivity.rs:24:10
1111
|
1212
LL | let y = A { a: 3, .. x };
@@ -104,7 +104,25 @@ LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b`
104104
|
105105
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
106106

107-
error: aborting due to 11 previous errors
107+
error[E0381]: assign to part of possibly uninitialized variable: `x`
108+
--> $DIR/borrowck-field-sensitivity.rs:91:5
109+
|
110+
LL | x.a = 1;
111+
| ^^^^^^^ use of possibly uninitialized `x`
112+
113+
error[E0381]: assign to part of possibly uninitialized variable: `x`
114+
--> $DIR/borrowck-field-sensitivity.rs:97:5
115+
|
116+
LL | x.a = 1;
117+
| ^^^^^^^ use of possibly uninitialized `x`
118+
119+
error[E0381]: assign to part of possibly uninitialized variable: `x`
120+
--> $DIR/borrowck-field-sensitivity.rs:104:5
121+
|
122+
LL | x.b = box 1;
123+
| ^^^ use of possibly uninitialized `x`
124+
125+
error: aborting due to 14 previous errors
108126

109-
Some errors occurred: E0382, E0499, E0505.
110-
For more information about an error, try `rustc --explain E0382`.
127+
Some errors occurred: E0381, E0382, E0499, E0505.
128+
For more information about an error, try `rustc --explain E0381`.

Diff for: src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0381]: use of possibly uninitialized variable: `origin.y`
1+
error[E0381]: use of possibly uninitialized variable: `origin`
22
--> $DIR/borrowck-init-in-fru.rs:22:5
33
|
44
LL | origin = point {x: 10,.. origin};

Diff for: src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0381]: use of possibly uninitialized variable: `origin.y`
1+
error[E0381]: use of possibly uninitialized variable: `origin`
22
--> $DIR/borrowck-init-in-fru.rs:22:5
33
|
44
LL | origin = point {x: 10,.. origin};

Diff for: src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0381]: use of possibly uninitialized variable: `a.x`
1+
error[E0381]: use of possibly uninitialized variable: `a`
22
--> $DIR/borrowck-uninit-field-access.rs:34:13
33
|
44
LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x`
55
| ^^^ use of possibly uninitialized `a.x`
66

7-
error[E0382]: use of moved value: `line1.origin.x`
7+
error[E0382]: use of moved value: `line1.origin`
88
--> $DIR/borrowck-uninit-field-access.rs:39:13
99
|
1010
LL | let _moved = line1.origin;

Diff for: src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0381]: use of possibly uninitialized variable: `a.x`
1+
error[E0381]: use of possibly uninitialized variable: `a`
22
--> $DIR/borrowck-uninit-field-access.rs:34:13
33
|
44
LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x`
55
| ^^^ use of possibly uninitialized `a.x`
66

7-
error[E0382]: use of moved value: `line1.origin.x`
7+
error[E0382]: use of moved value: `line1.origin`
88
--> $DIR/borrowck-uninit-field-access.rs:39:13
99
|
1010
LL | let _moved = line1.origin;
+24-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
1-
error[E0381]: borrow of possibly uninitialized variable: `**x`
1+
error[E0381]: borrow of possibly uninitialized variable: `x`
22
--> $DIR/borrowck-uninit-ref-chain.rs:21:14
33
|
44
LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
55
| ^^^^ use of possibly uninitialized `**x`
66

7-
error[E0381]: borrow of possibly uninitialized variable: `**x`
7+
error[E0381]: borrow of possibly uninitialized variable: `x`
88
--> $DIR/borrowck-uninit-ref-chain.rs:25:14
99
|
1010
LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
1111
| ^^^^ use of possibly uninitialized `**x`
1212

13-
error[E0381]: borrow of possibly uninitialized variable: `**x`
13+
error[E0381]: borrow of possibly uninitialized variable: `x`
1414
--> $DIR/borrowck-uninit-ref-chain.rs:29:14
1515
|
1616
LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
1717
| ^^^^ use of possibly uninitialized `**x`
1818

19-
error[E0381]: borrow of possibly uninitialized variable: `a.y`
20-
--> $DIR/borrowck-uninit-ref-chain.rs:46:14
19+
error[E0381]: assign to part of possibly uninitialized variable: `a`
20+
--> $DIR/borrowck-uninit-ref-chain.rs:34:5
2121
|
22-
LL | let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
23-
| ^^^^ use of possibly uninitialized `a.y`
22+
LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
23+
| ^^^^^^^ use of possibly uninitialized `a`
2424

25-
error[E0381]: borrow of possibly uninitialized variable: `**a.y`
26-
--> $DIR/borrowck-uninit-ref-chain.rs:51:14
25+
error[E0381]: assign to part of possibly uninitialized variable: `a`
26+
--> $DIR/borrowck-uninit-ref-chain.rs:39:5
2727
|
28-
LL | let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
29-
| ^^^^^^ use of possibly uninitialized `**a.y`
28+
LL | a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
29+
| ^^^^^^^^^ use of possibly uninitialized `a`
3030

31-
error: aborting due to 5 previous errors
31+
error[E0381]: assign to part of possibly uninitialized variable: `a`
32+
--> $DIR/borrowck-uninit-ref-chain.rs:45:5
33+
|
34+
LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
35+
| ^^^^^^^ use of possibly uninitialized `a`
36+
37+
error[E0381]: assign to part of possibly uninitialized variable: `a`
38+
--> $DIR/borrowck-uninit-ref-chain.rs:50:5
39+
|
40+
LL | a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381]
41+
| ^^^^^^^^^ use of possibly uninitialized `a`
42+
43+
error: aborting due to 7 previous errors
3244

3345
For more information about this error, try `rustc --explain E0381`.
+24-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
1-
error[E0381]: borrow of possibly uninitialized variable: `**x`
1+
error[E0381]: borrow of possibly uninitialized variable: `x`
22
--> $DIR/borrowck-uninit-ref-chain.rs:21:14
33
|
44
LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
55
| ^^^^ use of possibly uninitialized `**x`
66

7-
error[E0381]: borrow of possibly uninitialized variable: `**x`
7+
error[E0381]: borrow of possibly uninitialized variable: `x`
88
--> $DIR/borrowck-uninit-ref-chain.rs:25:14
99
|
1010
LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
1111
| ^^^^ use of possibly uninitialized `**x`
1212

13-
error[E0381]: borrow of possibly uninitialized variable: `**x`
13+
error[E0381]: borrow of possibly uninitialized variable: `x`
1414
--> $DIR/borrowck-uninit-ref-chain.rs:29:14
1515
|
1616
LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
1717
| ^^^^ use of possibly uninitialized `**x`
1818

19-
error[E0381]: borrow of possibly uninitialized variable: `a.y`
20-
--> $DIR/borrowck-uninit-ref-chain.rs:46:14
19+
error[E0381]: assign to part of possibly uninitialized variable: `a`
20+
--> $DIR/borrowck-uninit-ref-chain.rs:34:5
2121
|
22-
LL | let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
23-
| ^^^^ use of possibly uninitialized `a.y`
22+
LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
23+
| ^^^^^^^ use of possibly uninitialized `a`
2424

25-
error[E0381]: borrow of possibly uninitialized variable: `**a.y`
26-
--> $DIR/borrowck-uninit-ref-chain.rs:51:14
25+
error[E0381]: assign to part of possibly uninitialized variable: `a`
26+
--> $DIR/borrowck-uninit-ref-chain.rs:39:5
2727
|
28-
LL | let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
29-
| ^^^^^^ use of possibly uninitialized `**a.y`
28+
LL | a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
29+
| ^^^^^^^^^ use of possibly uninitialized `a`
3030

31-
error: aborting due to 5 previous errors
31+
error[E0381]: assign to part of possibly uninitialized variable: `a`
32+
--> $DIR/borrowck-uninit-ref-chain.rs:45:5
33+
|
34+
LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
35+
| ^^^^^^^ use of possibly uninitialized `a`
36+
37+
error[E0381]: assign to part of possibly uninitialized variable: `a`
38+
--> $DIR/borrowck-uninit-ref-chain.rs:50:5
39+
|
40+
LL | a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381]
41+
| ^^^^^^^^^ use of possibly uninitialized `a`
42+
43+
error: aborting due to 7 previous errors
3244

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

Diff for: src/test/ui/borrowck/borrowck-uninit-ref-chain.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ fn main() {
3131

3232

3333
let mut a: S<i32, i32>;
34-
a.x = 0;
34+
a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
3535
let _b = &a.x; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` [E0381]
36-
// (deliberately *not* an error under MIR-borrowck)
36+
3737

3838
let mut a: S<&&i32, &&i32>;
39-
a.x = &&0;
39+
a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
4040
let _b = &**a.x; //[ast]~ ERROR use of possibly uninitialized variable: `**a.x` [E0381]
41-
// (deliberately *not* an error under MIR-borrowck)
41+
4242

4343

4444
let mut a: S<i32, i32>;
45-
a.x = 0;
45+
a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
4646
let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
47-
//[mir]~^ ERROR [E0381]
47+
4848

4949
let mut a: S<&&i32, &&i32>;
50-
a.x = &&0;
50+
a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381]
5151
let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
52-
//[mir]~^ ERROR [E0381]
52+
5353
}

Diff for: src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0382]: use of moved value: `u.a`
1+
error[E0382]: use of moved value: `u`
22
--> $DIR/borrowck-union-move-assign.rs:27:21
33
|
44
LL | let a = u.a;
@@ -8,7 +8,7 @@ LL | let a = u.a; //~ ERROR use of moved value: `u.a`
88
|
99
= note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
1010

11-
error[E0382]: use of moved value: `u.a`
11+
error[E0382]: use of moved value: `u`
1212
--> $DIR/borrowck-union-move-assign.rs:33:21
1313
|
1414
LL | let a = u.a;
@@ -19,7 +19,7 @@ LL | let a = u.a; // OK
1919
|
2020
= note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
2121

22-
error[E0382]: use of moved value: `u.a`
22+
error[E0382]: use of moved value: `u`
2323
--> $DIR/borrowck-union-move-assign.rs:39:21
2424
|
2525
LL | let a = u.a;

Diff for: src/test/ui/borrowck/borrowck-union-move.nll.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0382]: use of moved value: `u.n1`
1+
error[E0382]: use of moved value: `u`
22
--> $DIR/borrowck-union-move.rs:36:21
33
|
44
LL | let a = u.n1;
@@ -18,7 +18,7 @@ LL | let a = u; //~ ERROR use of partially moved value: `u`
1818
|
1919
= note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
2020

21-
error[E0382]: use of moved value: `u.n2`
21+
error[E0382]: use of moved value: `u`
2222
--> $DIR/borrowck-union-move.rs:46:21
2323
|
2424
LL | let a = u.n1;
@@ -28,7 +28,7 @@ LL | let a = u.n2; //~ ERROR use of moved value: `u.n2`
2828
|
2929
= note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
3030

31-
error[E0382]: use of moved value: `u.n`
31+
error[E0382]: use of moved value: `u`
3232
--> $DIR/borrowck-union-move.rs:73:21
3333
|
3434
LL | let a = u.n;
@@ -38,7 +38,7 @@ LL | let a = u.n; //~ ERROR use of moved value: `u.n`
3838
|
3939
= note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
4040

41-
error[E0382]: use of moved value: `u.c`
41+
error[E0382]: use of moved value: `u`
4242
--> $DIR/borrowck-union-move.rs:78:21
4343
|
4444
LL | let a = u.n;
+11-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
error[E0381]: use of possibly uninitialized variable: `u.a`
2-
--> $DIR/borrowck-union-uninitialized.rs:26:18
1+
error[E0381]: assign to part of possibly uninitialized variable: `s`
2+
--> $DIR/borrowck-union-uninitialized.rs:23:9
33
|
4-
LL | let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a`
5-
| ^^^ use of possibly uninitialized `u.a`
4+
LL | s.a = 0;
5+
| ^^^^^^^ use of possibly uninitialized `s`
66

7-
error: aborting due to previous error
7+
error[E0381]: assign to part of possibly uninitialized variable: `u`
8+
--> $DIR/borrowck-union-uninitialized.rs:24:9
9+
|
10+
LL | u.a = 0;
11+
| ^^^^^^^ use of possibly uninitialized `u`
12+
13+
error: aborting due to 2 previous errors
814

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

Diff for: src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0381]: use of possibly uninitialized variable: `*w`
1+
error[E0381]: use of possibly uninitialized variable: `w`
22
--> $DIR/borrowck-use-in-index-lvalue.rs:16:5
33
|
44
LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
55
| ^^^^ use of possibly uninitialized `*w`
66

7-
error[E0381]: use of possibly uninitialized variable: `*w`
7+
error[E0381]: use of possibly uninitialized variable: `w`
88
--> $DIR/borrowck-use-in-index-lvalue.rs:20:5
99
|
1010
LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]

Diff for: src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0381]: use of possibly uninitialized variable: `*w`
1+
error[E0381]: use of possibly uninitialized variable: `w`
22
--> $DIR/borrowck-use-in-index-lvalue.rs:16:5
33
|
44
LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
55
| ^^^^ use of possibly uninitialized `*w`
66

7-
error[E0381]: use of possibly uninitialized variable: `*w`
7+
error[E0381]: use of possibly uninitialized variable: `w`
88
--> $DIR/borrowck-use-in-index-lvalue.rs:20:5
99
|
1010
LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]

Diff for: src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0381]: borrow of possibly uninitialized variable: `*x`
1+
error[E0381]: borrow of possibly uninitialized variable: `x`
22
--> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13
33
|
44
LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`

Diff for: src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0381]: borrow of possibly uninitialized variable: `*x`
1+
error[E0381]: borrow of possibly uninitialized variable: `x`
22
--> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13
33
|
44
LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`

Diff for: src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0381]: borrow of possibly uninitialized variable: `*x`
1+
error[E0381]: borrow of possibly uninitialized variable: `x`
22
--> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13
33
|
44
LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]

Diff for: src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0381]: borrow of possibly uninitialized variable: `*x`
1+
error[E0381]: borrow of possibly uninitialized variable: `x`
22
--> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13
33
|
44
LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]

0 commit comments

Comments
 (0)