2019-06-24 21:39:23 -05:00
|
|
|
// compile-fail
|
|
|
|
|
|
|
|
pub const unsafe fn fake_type<T>() -> T {
|
2019-11-11 08:32:36 -06:00
|
|
|
hint_unreachable()
|
2019-06-24 21:39:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub const unsafe fn hint_unreachable() -> ! {
|
2019-11-11 08:32:36 -06:00
|
|
|
fake_type() //~ ERROR cycle detected when const-evaluating `hint_unreachable` [E0391]
|
2019-06-24 21:39:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
trait Const {
|
|
|
|
const CONSTANT: i32 = unsafe { fake_type() };
|
|
|
|
}
|
|
|
|
|
|
|
|
impl <T> Const for T {}
|
|
|
|
|
|
|
|
pub fn main() -> () {
|
2019-11-11 08:32:36 -06:00
|
|
|
dbg!(i32::CONSTANT);
|
2019-06-24 21:39:23 -05:00
|
|
|
}
|