From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/unsafe/unsafe-const-fn.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/ui/unsafe/unsafe-const-fn.rs (limited to 'tests/ui/unsafe/unsafe-const-fn.rs') diff --git a/tests/ui/unsafe/unsafe-const-fn.rs b/tests/ui/unsafe/unsafe-const-fn.rs new file mode 100644 index 000000000..65e3acf30 --- /dev/null +++ b/tests/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); +} -- cgit v1.2.3