diff options
Diffstat (limited to 'src/test/ui/unsafe/unsafe-const-fn.rs')
-rw-r--r-- | src/test/ui/unsafe/unsafe-const-fn.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/unsafe/unsafe-const-fn.rs b/src/test/ui/unsafe/unsafe-const-fn.rs new file mode 100644 index 000000000..65e3acf30 --- /dev/null +++ b/src/test/ui/unsafe/unsafe-const-fn.rs @@ -0,0 +1,15 @@ +// A quick test of 'unsafe const fn' functionality + +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +const unsafe fn dummy(v: u32) -> u32 { + !v +} + +const VAL: u32 = dummy(0xFFFF); +//~^ ERROR E0133 + +fn main() { + assert_eq!(VAL, 0xFFFF0000); +} |