mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-16 02:31:13 +00:00
20 lines
369 B
Rust
20 lines
369 B
Rust
//@ 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() //~ inside
|
|
}
|
|
|
|
trait Const {
|
|
const CONSTANT: i32 = unsafe { fake_type() }; //~ inside
|
|
}
|
|
|
|
impl<T> Const for T {}
|
|
|
|
pub fn main() -> () {
|
|
dbg!(i32::CONSTANT);
|
|
}
|