Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add regression tests
  • Loading branch information
oli-obk committed May 23, 2024
commit 301c8decceb7bb87de350cf062140e937c4d6120
14 changes: 14 additions & 0 deletions tests/ui/consts/erroneous_type_in_promoted.rs
Original file line number Diff line number Diff line change
@@ -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() {}
28 changes: 28 additions & 0 deletions tests/ui/consts/erroneous_type_in_promoted.stderr
Original file line number Diff line number Diff line change
@@ -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`.