Skip to content

Commit 301c8de

Browse files
committed
Add regression tests
1 parent 39d2f2a commit 301c8de

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//! ICE test #124348
2+
//! We should not be running const eval if the layout has errors.
3+
4+
enum Eek {
5+
TheConst,
6+
UnusedByTheConst(Sum),
7+
//~^ ERROR cannot find type `Sum` in this scope
8+
}
9+
10+
const fn foo() {
11+
let x: &'static [Eek] = &[];
12+
}
13+
14+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error[E0412]: cannot find type `Sum` in this scope
2+
--> $DIR/erroneous_type_in_promoted.rs:6:22
3+
|
4+
LL | UnusedByTheConst(Sum),
5+
| ^^^ not found in this scope
6+
|
7+
help: consider importing this trait
8+
|
9+
LL + use std::iter::Sum;
10+
|
11+
12+
note: erroneous constant encountered
13+
--> $DIR/erroneous_type_in_promoted.rs:11:29
14+
|
15+
LL | let x: &'static [Eek] = &[];
16+
| ^^^
17+
18+
note: erroneous constant encountered
19+
--> $DIR/erroneous_type_in_promoted.rs:11:29
20+
|
21+
LL | let x: &'static [Eek] = &[];
22+
| ^^^
23+
|
24+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
25+
26+
error: aborting due to 1 previous error
27+
28+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)