summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/uninhabited-const-issue-61744.rs
blob: ca6449cce30d516cde02916971290a9bbf199781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// build-fail

pub const unsafe fn fake_type<T>() -> T {
    hint_unreachable() //~ ERROR evaluation of `<i32 as Const>::CONSTANT` failed
}

pub const unsafe fn hint_unreachable() -> ! {
    fake_type()
}

trait Const {
    const CONSTANT: i32 = unsafe { fake_type() };
}

impl<T> Const for T {}

pub fn main() -> () {
    dbg!(i32::CONSTANT); //~ constant
}