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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
198 B
Rust
Raw Normal View History

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