rust/tests/ui/unsafe/unsafe-const-fn.rs

16 lines
263 B
Rust
Raw Normal View History

2015-10-03 23:42:22 +08:00
// A quick test of 'unsafe const fn' functionality
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
const unsafe fn dummy(v: u32) -> u32 {
2015-10-03 23:42:22 +08:00
!v
}
2016-08-10 15:29:45 +08:00
const VAL: u32 = dummy(0xFFFF);
//~^ ERROR E0133
2015-10-03 23:42:22 +08:00
fn main() {
assert_eq!(VAL, 0xFFFF0000);
}