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 --- .../const-extern-fn/const-extern-fn-requires-unsafe.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs (limited to 'tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs') diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs new file mode 100644 index 000000000..afe645ae8 --- /dev/null +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -0,0 +1,14 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +#![feature(const_extern_fn)] + +const unsafe extern "C" fn foo() -> usize { 5 } + +fn main() { + let a: [u8; foo()]; + //[mir]~^ call to unsafe function is unsafe and requires unsafe function or block + //[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block + foo(); + //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block +} -- cgit v1.2.3