about summary refs log tree commit diff
path: root/tests/ui/consts/uninhabited-const-issue-61744.rs
blob: 56f0939ef183c6b4e935ff6267befc19288bc320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ 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);
}