rust/tests/ui/consts/uninhabited-const-issue-61744.rs
Ralf Jung 17946c22b1 const-eval error: always say in which item the error occurred
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07 13:42:30 +02:00

22 lines
499 B
Rust

//@ build-fail
//@ dont-require-annotations: NOTE
pub const unsafe fn fake_type<T>() -> T {
hint_unreachable() //~ NOTE inside
}
pub const unsafe fn hint_unreachable() -> ! {
fake_type() //~ NOTE inside
}
trait Const {
const CONSTANT: i32 = unsafe { fake_type() }; //~ ERROR reached the configured maximum number of stack frames
//~^ NOTE evaluation of `<i32 as Const>::CONSTANT` failed inside this call
}
impl<T> Const for T {}
pub fn main() -> () {
dbg!(i32::CONSTANT);
}