Rollup merge of #124516 - oli-obk:taint_const_eval, r=RalfJung
Allow monomorphization time const eval failures if the cause is a type layout issue r? `@RalfJung` fixes #124348
This commit is contained in:
commit
eb6b35b5bc
8 changed files with 76 additions and 14 deletions
12
tests/ui/consts/erroneous_type_in_const_return_value.rs
Normal file
12
tests/ui/consts/erroneous_type_in_const_return_value.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
//! 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 EEK_ZERO: &[Eek] = &[];
|
||||
|
||||
fn main() {}
|
||||
14
tests/ui/consts/erroneous_type_in_const_return_value.stderr
Normal file
14
tests/ui/consts/erroneous_type_in_const_return_value.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0412]: cannot find type `Sum` in this scope
|
||||
--> $DIR/erroneous_type_in_const_return_value.rs:6:22
|
||||
|
|
||||
LL | UnusedByTheConst(Sum),
|
||||
| ^^^ not found in this scope
|
||||
|
|
||||
help: consider importing this trait
|
||||
|
|
||||
LL + use std::iter::Sum;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
||||
14
tests/ui/consts/erroneous_type_in_promoted.rs
Normal file
14
tests/ui/consts/erroneous_type_in_promoted.rs
Normal 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() {}
|
||||
14
tests/ui/consts/erroneous_type_in_promoted.stderr
Normal file
14
tests/ui/consts/erroneous_type_in_promoted.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
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;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue