Add regression tests

This commit is contained in:
Oli Scherer 2024-05-23 10:44:10 +00:00
parent 39d2f2affd
commit 301c8decce
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,14 @@
//! ICE test #124348
//! We should not be running const eval if the layout has errors.
enum Eek {
TheConst,
UnusedByTheConst(Sum),
//~^ ERROR cannot find type `Sum` in this scope
}
const fn foo() {
let x: &'static [Eek] = &[];
}
fn main() {}

View File

@ -0,0 +1,28 @@
error[E0412]: cannot find type `Sum` in this scope
--> $DIR/erroneous_type_in_promoted.rs:6:22
|
LL | UnusedByTheConst(Sum),
| ^^^ not found in this scope
|
help: consider importing this trait
|
LL + use std::iter::Sum;
|
note: erroneous constant encountered
--> $DIR/erroneous_type_in_promoted.rs:11:29
|
LL | let x: &'static [Eek] = &[];
| ^^^
note: erroneous constant encountered
--> $DIR/erroneous_type_in_promoted.rs:11:29
|
LL | let x: &'static [Eek] = &[];
| ^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0412`.