]>
Commit | Line | Data |
---|---|---|
dc9dc135 XL |
1 | // compile-fail |
2 | ||
3 | pub const unsafe fn fake_type<T>() -> T { | |
60c5eb7d | 4 | hint_unreachable() |
dc9dc135 XL |
5 | } |
6 | ||
7 | pub const unsafe fn hint_unreachable() -> ! { | |
60c5eb7d | 8 | fake_type() //~ ERROR cycle detected when const-evaluating `hint_unreachable` [E0391] |
dc9dc135 XL |
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() -> () { | |
60c5eb7d | 18 | dbg!(i32::CONSTANT); |
dc9dc135 | 19 | } |