]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/uninhabited-const-issue-61744.rs
Do not suggest `let_else` if no bindings would be introduced
[rust.git] / src / test / ui / consts / uninhabited-const-issue-61744.rs
1 // build-fail
2
3 pub const unsafe fn fake_type<T>() -> T {
4     hint_unreachable() //~ ERROR any use of this value will cause an error [const_err]
5     //~| WARN this was previously accepted by the compiler but is being phased out
6 }
7
8 pub const unsafe fn hint_unreachable() -> ! {
9     fake_type()
10 }
11
12 trait Const {
13     const CONSTANT: i32 = unsafe { fake_type() };
14 }
15
16 impl<T> Const for T {}
17
18 pub fn main() -> () {
19     dbg!(i32::CONSTANT); //~ ERROR erroneous constant used
20 }