Skip to content

Commit cd92da8

Browse files
committed
Update E0161 test to cover more cases
Update another test that broke due to E0161 no longer being buffered
1 parent b83fe42 commit cd92da8

11 files changed

+106
-15
lines changed

src/test/ui/dst/dst-index.nll.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ error[E0161]: cannot move a value of type str: the size of str cannot be statica
44
LL | S[0];
55
| ^^^^
66

7-
error[E0507]: cannot move out of borrowed content
8-
--> $DIR/dst-index.rs:41:5
9-
|
10-
LL | S[0];
11-
| ^^^^ cannot move out of borrowed content
12-
137
error[E0161]: cannot move a value of type dyn std::fmt::Debug: the size of dyn std::fmt::Debug cannot be statically determined
148
--> $DIR/dst-index.rs:44:5
159
|
1610
LL | T[0];
1711
| ^^^^
1812

13+
error[E0507]: cannot move out of borrowed content
14+
--> $DIR/dst-index.rs:41:5
15+
|
16+
LL | S[0];
17+
| ^^^^ cannot move out of borrowed content
18+
1919
error[E0507]: cannot move out of borrowed content
2020
--> $DIR/dst-index.rs:44:5
2121
|

src/test/ui/dst/dst-rvalue.nll.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ error[E0161]: cannot move a value of type str: the size of str cannot be statica
44
LL | let _x: Box<str> = box *"hello world";
55
| ^^^^^^^^^^^^^^
66

7-
error[E0507]: cannot move out of borrowed content
8-
--> $DIR/dst-rvalue.rs:16:28
9-
|
10-
LL | let _x: Box<str> = box *"hello world";
11-
| ^^^^^^^^^^^^^^ cannot move out of borrowed content
12-
137
error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined
148
--> $DIR/dst-rvalue.rs:21:32
159
|
1610
LL | let _x: Box<[isize]> = box *array;
1711
| ^^^^^^
1812

13+
error[E0507]: cannot move out of borrowed content
14+
--> $DIR/dst-rvalue.rs:16:28
15+
|
16+
LL | let _x: Box<str> = box *"hello world";
17+
| ^^^^^^^^^^^^^^ cannot move out of borrowed content
18+
1919
error[E0508]: cannot move out of type `[isize]`, a non-copy slice
2020
--> $DIR/dst-rvalue.rs:21:32
2121
|
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:9
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:5
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:9
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:5
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:9
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:5
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.

src/test/ui/error-codes/E0161.rs

+22-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,28 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-compare-mode-nll
12+
13+
// Check that E0161 is a hard error in all possible configurations that might
14+
// affect it.
15+
16+
// revisions: ast nll zflags edition astul nllul zflagsul editionul
17+
//[zflags]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
18+
//[edition]edition:2018
19+
//[zflagsul]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
20+
//[editionul]edition:2018
21+
22+
#![cfg_attr(nll, feature(nll))]
23+
#![cfg_attr(nllul, feature(nll))]
24+
#![cfg_attr(astul, feature(unsized_locals))]
25+
#![cfg_attr(zflagsul, feature(unsized_locals))]
26+
#![cfg_attr(nllul, feature(unsized_locals))]
27+
#![cfg_attr(editionul, feature(unsized_locals))]
28+
1129
#![feature(box_syntax)]
1230

13-
fn main() {
14-
let _x: Box<str> = box *"hello"; //~ ERROR E0161
15-
//~^ ERROR E0507
31+
fn foo(x: Box<[i32]>) {
32+
box *x; //~ ERROR E0161
1633
}
34+
35+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:9
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
2+
--> $DIR/E0161.rs:32:5
3+
|
4+
LL | box *x; //~ ERROR E0161
5+
| ^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.

0 commit comments

Comments
 (0)