]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/uninhabited-const-issue-61744.rs
Rollup merge of #64603 - gilescope:unused-lifetime-warning, r=matthewjasper
[rust.git] / src / test / ui / consts / uninhabited-const-issue-61744.rs
1 // compile-fail
2
3 pub const unsafe fn fake_type<T>() -> T {
4     hint_unreachable() //~ ERROR any use of this value will cause an error
5 }
6
7 pub const unsafe fn hint_unreachable() -> ! {
8     fake_type()
9 }
10
11 trait Const {
12     const CONSTANT: i32 = unsafe { fake_type() };
13 }
14
15 impl <T> Const for T {}
16
17 pub fn main() -> () {
18     dbg!(i32::CONSTANT); //~ ERROR erroneous constant used
19 }