Skip to content

Commit 0c0478d

Browse files
committed
adjust remaining tests
1 parent 303dbcc commit 0c0478d

File tree

6 files changed

+39
-4
lines changed

6 files changed

+39
-4
lines changed

src/test/compile-fail/const-fn-error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const fn f(x: usize) -> usize {
1919
for i in 0..x {
2020
//~^ ERROR E0015
2121
//~| ERROR E0019
22+
//~| ERROR E0080
2223
sum += i;
2324
}
2425
sum

src/test/compile-fail/issue-52443.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ fn main() {
1414
[(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
1515
[(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
1616
//~^ ERROR constant contains unimplemented expression type
17+
//~| ERROR evaluation of constant value failed
1718
}

src/test/ui/issues/issue-39559-2.rs

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ impl Dim for Dim3 {
2323
fn main() {
2424
let array: [usize; Dim3::dim()]
2525
//~^ ERROR E0015
26+
//~| ERROR E0080
2627
= [0; Dim3::dim()];
2728
//~^ ERROR E0015
29+
//~| ERROR E0080
2830
}

src/test/ui/issues/issue-39559-2.stderr

+16-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,25 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
44
LL | let array: [usize; Dim3::dim()]
55
| ^^^^^^^^^^^
66

7+
error[E0080]: evaluation of constant value failed
8+
--> $DIR/issue-39559-2.rs:24:24
9+
|
10+
LL | let array: [usize; Dim3::dim()]
11+
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
12+
713
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
8-
--> $DIR/issue-39559-2.rs:26:15
14+
--> $DIR/issue-39559-2.rs:27:15
915
|
1016
LL | = [0; Dim3::dim()];
1117
| ^^^^^^^^^^^
1218

13-
error: aborting due to 2 previous errors
19+
error[E0080]: evaluation of constant value failed
20+
--> $DIR/issue-39559-2.rs:27:15
21+
|
22+
LL | = [0; Dim3::dim()];
23+
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
24+
25+
error: aborting due to 4 previous errors
1426

15-
For more information about this error, try `rustc --explain E0015`.
27+
Some errors occurred: E0015, E0080.
28+
For more information about an error, try `rustc --explain E0015`.

src/test/ui/issues/issue-43105.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ fn xyz() -> u8 { 42 }
1212

1313
const NUM: u8 = xyz();
1414
//~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
15+
//~| ERROR any use of this value will cause an error [const_err]
1516

1617
fn main() {
1718
match 1 {
1819
NUM => unimplemented!(),
20+
//~^ ERROR could not evaluate constant pattern
1921
_ => unimplemented!(),
2022
}
2123
}

src/test/ui/issues/issue-43105.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
44
LL | const NUM: u8 = xyz();
55
| ^^^^^
66

7-
error: aborting due to previous error
7+
error: any use of this value will cause an error
8+
--> $DIR/issue-43105.rs:13:1
9+
|
10+
LL | const NUM: u8 = xyz();
11+
| ^^^^^^^^^^^^^^^^-----^
12+
| |
13+
| calling non-const function `xyz`
14+
|
15+
= note: #[deny(const_err)] on by default
16+
17+
error: could not evaluate constant pattern
18+
--> $DIR/issue-43105.rs:19:9
19+
|
20+
LL | NUM => unimplemented!(),
21+
| ^^^
22+
23+
error: aborting due to 3 previous errors
824

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

0 commit comments

Comments
 (0)