diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr similarity index 85% rename from src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr rename to src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr index c95fe1734887..d22413beecbc 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:12:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | LL | S::f(); | ^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | S::f(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:13:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:15:5 | LL | f(); | ^^^ call to unsafe function @@ -15,7 +15,7 @@ LL | f(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 | LL | S::f(); | ^^^^^^ call to unsafe function @@ -23,7 +23,7 @@ LL | S::f(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:18:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:20:5 | LL | f(); | ^^^ call to unsafe function diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs index ccc1b8553f07..2ed343b4a07f 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs @@ -1,4 +1,6 @@ // edition:2018 +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck struct S; diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr new file mode 100644 index 000000000000..d22413beecbc --- /dev/null +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr @@ -0,0 +1,35 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 + | +LL | S::f(); + | ^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:15:5 + | +LL | f(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 + | +LL | S::f(); + | ^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:20:5 + | +LL | f(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr b/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr similarity index 86% rename from src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr rename to src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr index 190b4792ebcb..2f9c7973b5a1 100644 --- a/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr +++ b/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:12:23 + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 | LL | let result: i32 = foo(5, 5); | ^^^^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | let result: i32 = foo(5, 5); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:21:23 + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 | LL | let result: i32 = foo(5, 5); | ^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs b/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs index 76a0f2914103..bdb3eb23c38f 100644 --- a/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs +++ b/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + // Ensure we get unsafe function after coercion unsafe fn add(a: i32, b: i32) -> i32 { a + b diff --git a/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr b/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr new file mode 100644 index 000000000000..2f9c7973b5a1 --- /dev/null +++ b/src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 + | +LL | let result: i32 = foo(5, 5); + | ^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 + | +LL | let result: i32 = foo(5, 5); + | ^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr similarity index 89% rename from src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr rename to src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr index a1fb1c02e462..a60100ddaeae 100644 --- a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31 + --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31 | LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs index 36777693faba..57358fbdd840 100644 --- a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + fn main() { let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; //~^ ERROR E0133 diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr new file mode 100644 index 000000000000..a60100ddaeae --- /dev/null +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31 + | +LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr similarity index 86% rename from src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr rename to src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr index 5196b8ee0a21..b643ecc0ce8d 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:8:5 + --> $DIR/const-extern-fn-requires-unsafe.rs:11:5 | LL | foo(); | ^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | foo(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:6:17 + --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 | LL | let a: [u8; foo()]; | ^^^^^ call to unsafe function diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs index 71e6c2cb8585..1ce781479708 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + #![feature(const_extern_fn)] const unsafe extern "C" fn foo() -> usize { 5 } diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr new file mode 100644 index 000000000000..b643ecc0ce8d --- /dev/null +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/const-extern-fn-requires-unsafe.rs:11:5 + | +LL | foo(); + | ^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 + | +LL | let a: [u8; foo()]; + | ^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/error-codes/E0133.stderr b/src/test/ui/error-codes/E0133.mir.stderr similarity index 93% rename from src/test/ui/error-codes/E0133.stderr rename to src/test/ui/error-codes/E0133.mir.stderr index 1eb696506f34..b11d5e2c2fc7 100644 --- a/src/test/ui/error-codes/E0133.stderr +++ b/src/test/ui/error-codes/E0133.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/E0133.rs:4:5 + --> $DIR/E0133.rs:7:5 | LL | f(); | ^^^ call to unsafe function diff --git a/src/test/ui/error-codes/E0133.rs b/src/test/ui/error-codes/E0133.rs index 52494ce6078c..dee1475ba213 100644 --- a/src/test/ui/error-codes/E0133.rs +++ b/src/test/ui/error-codes/E0133.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + unsafe fn f() { return; } fn main() { diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr b/src/test/ui/error-codes/E0133.thir.stderr similarity index 88% rename from src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr rename to src/test/ui/error-codes/E0133.thir.stderr index 80d2c6ced24c..b11d5e2c2fc7 100644 --- a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr +++ b/src/test/ui/error-codes/E0133.thir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-called-from-safe.rs:4:5 + --> $DIR/E0133.rs:7:5 | LL | f(); | ^^^ call to unsafe function diff --git a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.mir.stderr similarity index 90% rename from src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr rename to src/test/ui/feature-gates/feature-gate-const_fn_transmute.mir.stderr index 08ba14dc40e8..04efea0b230d 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.mir.stderr @@ -1,5 +1,5 @@ error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:8:43 + --> $DIR/feature-gate-const_fn_transmute.rs:11:43 | LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } } = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:11:53 + --> $DIR/feature-gate-const_fn_transmute.rs:14:53 | LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transm = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:14:58 + --> $DIR/feature-gate-const_fn_transmute.rs:17:58 | LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics:: = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:17:48 + --> $DIR/feature-gate-const_fn_transmute.rs:20:48 | LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:20:58 + --> $DIR/feature-gate-const_fn_transmute.rs:23:58 | LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::t = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:23:63 + --> $DIR/feature-gate-const_fn_transmute.rs:26:63 | LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrins = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:26:39 + --> $DIR/feature-gate-const_fn_transmute.rs:29:39 | LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:30:49 + --> $DIR/feature-gate-const_fn_transmute.rs:33:49 | LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute( = note: `transmute` is only allowed in constants and statics for now error[E0658]: `transmute` is not allowed in constant functions - --> $DIR/feature-gate-const_fn_transmute.rs:34:54 + --> $DIR/feature-gate-const_fn_transmute.rs:37:54 | LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::tran = note: `transmute` is only allowed in constants and statics for now error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/feature-gate-const_fn_transmute.rs:26:39 + --> $DIR/feature-gate-const_fn_transmute.rs:29:39 | LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -97,7 +97,7 @@ LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/feature-gate-const_fn_transmute.rs:30:49 + --> $DIR/feature-gate-const_fn_transmute.rs:33:49 | LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -105,7 +105,7 @@ LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute( = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/feature-gate-const_fn_transmute.rs:34:54 + --> $DIR/feature-gate-const_fn_transmute.rs:37:54 | LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs index 9007e501bc2b..9a45dbc51d42 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs +++ b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + use std::mem; #[repr(transparent)] diff --git a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr new file mode 100644 index 000000000000..04efea0b230d --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr @@ -0,0 +1,118 @@ +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:11:43 + | +LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:14:53 + | +LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:17:58 + | +LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:20:48 + | +LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:23:58 + | +LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:26:63 + | +LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:29:39 + | +LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:33:49 + | +LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0658]: `transmute` is not allowed in constant functions + --> $DIR/feature-gate-const_fn_transmute.rs:37:54 + | +LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53605 for more information + = help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable + = note: `transmute` is only allowed in constants and statics for now + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/feature-gate-const_fn_transmute.rs:29:39 + | +LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/feature-gate-const_fn_transmute.rs:33:49 + | +LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/feature-gate-const_fn_transmute.rs:37:54 + | +LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 12 previous errors + +Some errors have detailed explanations: E0133, E0658. +For more information about an error, try `rustc --explain E0133`. diff --git a/src/test/ui/foreign-unsafe-fn-called.stderr b/src/test/ui/foreign-unsafe-fn-called.mir.stderr similarity index 89% rename from src/test/ui/foreign-unsafe-fn-called.stderr rename to src/test/ui/foreign-unsafe-fn-called.mir.stderr index afc9632de7cf..d3cf5d84fdd9 100644 --- a/src/test/ui/foreign-unsafe-fn-called.stderr +++ b/src/test/ui/foreign-unsafe-fn-called.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:8:5 + --> $DIR/foreign-unsafe-fn-called.rs:11:5 | LL | test::free(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/foreign-unsafe-fn-called.rs b/src/test/ui/foreign-unsafe-fn-called.rs index abbe462021ed..de3de286fc93 100644 --- a/src/test/ui/foreign-unsafe-fn-called.rs +++ b/src/test/ui/foreign-unsafe-fn-called.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + mod test { extern "C" { pub fn free(); diff --git a/src/test/ui/foreign-unsafe-fn-called.thir.stderr b/src/test/ui/foreign-unsafe-fn-called.thir.stderr new file mode 100644 index 000000000000..d3cf5d84fdd9 --- /dev/null +++ b/src/test/ui/foreign-unsafe-fn-called.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/foreign-unsafe-fn-called.rs:11:5 + | +LL | test::free(); + | ^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/intrinsics/unchecked_math_unsafe.stderr b/src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr similarity index 89% rename from src/test/ui/intrinsics/unchecked_math_unsafe.stderr rename to src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr index 4066cf8efb8c..26b2f9f27131 100644 --- a/src/test/ui/intrinsics/unchecked_math_unsafe.stderr +++ b/src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:5:15 + --> $DIR/unchecked_math_unsafe.rs:8:15 | LL | let add = std::intrinsics::unchecked_add(x, y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | let add = std::intrinsics::unchecked_add(x, y); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:6:15 + --> $DIR/unchecked_math_unsafe.rs:9:15 | LL | let sub = std::intrinsics::unchecked_sub(x, y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -15,7 +15,7 @@ LL | let sub = std::intrinsics::unchecked_sub(x, y); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:7:15 + --> $DIR/unchecked_math_unsafe.rs:10:15 | LL | let mul = std::intrinsics::unchecked_mul(x, y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/intrinsics/unchecked_math_unsafe.rs b/src/test/ui/intrinsics/unchecked_math_unsafe.rs index a034b45f5308..98d3a11ad027 100644 --- a/src/test/ui/intrinsics/unchecked_math_unsafe.rs +++ b/src/test/ui/intrinsics/unchecked_math_unsafe.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + #![feature(core_intrinsics)] fn main() { diff --git a/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr b/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr new file mode 100644 index 000000000000..26b2f9f27131 --- /dev/null +++ b/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr @@ -0,0 +1,27 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unchecked_math_unsafe.rs:8:15 + | +LL | let add = std::intrinsics::unchecked_add(x, y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unchecked_math_unsafe.rs:9:15 + | +LL | let sub = std::intrinsics::unchecked_sub(x, y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unchecked_math_unsafe.rs:10:15 + | +LL | let mul = std::intrinsics::unchecked_mul(x, y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-28776.stderr b/src/test/ui/issues/issue-28776.mir.stderr similarity index 93% rename from src/test/ui/issues/issue-28776.stderr rename to src/test/ui/issues/issue-28776.mir.stderr index 7faac88e26a2..1d470fb5e0f0 100644 --- a/src/test/ui/issues/issue-28776.stderr +++ b/src/test/ui/issues/issue-28776.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-28776.rs:4:5 + --> $DIR/issue-28776.rs:7:5 | LL | (&ptr::write)(1 as *mut _, 42); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/issues/issue-28776.rs b/src/test/ui/issues/issue-28776.rs index e564ebcd110c..19df3c4a4252 100644 --- a/src/test/ui/issues/issue-28776.rs +++ b/src/test/ui/issues/issue-28776.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + use std::ptr; fn main() { diff --git a/src/test/ui/issues/issue-28776.thir.stderr b/src/test/ui/issues/issue-28776.thir.stderr new file mode 100644 index 000000000000..1d470fb5e0f0 --- /dev/null +++ b/src/test/ui/issues/issue-28776.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-28776.rs:7:5 + | +LL | (&ptr::write)(1 as *mut _, 42); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-3080.stderr b/src/test/ui/issues/issue-3080.mir.stderr similarity index 92% rename from src/test/ui/issues/issue-3080.stderr rename to src/test/ui/issues/issue-3080.mir.stderr index 138d6df679fc..f395c30b8155 100644 --- a/src/test/ui/issues/issue-3080.stderr +++ b/src/test/ui/issues/issue-3080.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-3080.rs:7:5 + --> $DIR/issue-3080.rs:10:5 | LL | X(()).with(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/issues/issue-3080.rs b/src/test/ui/issues/issue-3080.rs index 883f3bfd24e8..2b5269dda8fa 100644 --- a/src/test/ui/issues/issue-3080.rs +++ b/src/test/ui/issues/issue-3080.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + struct X(()); impl X { pub unsafe fn with(&self) { } diff --git a/src/test/ui/issues/issue-3080.thir.stderr b/src/test/ui/issues/issue-3080.thir.stderr new file mode 100644 index 000000000000..f395c30b8155 --- /dev/null +++ b/src/test/ui/issues/issue-3080.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-3080.rs:10:5 + | +LL | X(()).with(); + | ^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/issues/issue-5844.stderr b/src/test/ui/issues/issue-5844.mir.stderr similarity index 93% rename from src/test/ui/issues/issue-5844.stderr rename to src/test/ui/issues/issue-5844.mir.stderr index ed5a3dc6b1e1..6134d6889ff6 100644 --- a/src/test/ui/issues/issue-5844.stderr +++ b/src/test/ui/issues/issue-5844.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:6:5 + --> $DIR/issue-5844.rs:8:5 | LL | issue_5844_aux::rand(); | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/issues/issue-5844.rs b/src/test/ui/issues/issue-5844.rs index b855e87e3f55..4f90a9c66451 100644 --- a/src/test/ui/issues/issue-5844.rs +++ b/src/test/ui/issues/issue-5844.rs @@ -1,4 +1,6 @@ //aux-build:issue-5844-aux.rs +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck extern crate issue_5844_aux; diff --git a/src/test/ui/issues/issue-5844.thir.stderr b/src/test/ui/issues/issue-5844.thir.stderr new file mode 100644 index 000000000000..6134d6889ff6 --- /dev/null +++ b/src/test/ui/issues/issue-5844.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-5844.rs:8:5 + | +LL | issue_5844_aux::rand(); + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/threads-sendsync/issue-43733.stderr b/src/test/ui/threads-sendsync/issue-43733.mir.stderr similarity index 74% rename from src/test/ui/threads-sendsync/issue-43733.stderr rename to src/test/ui/threads-sendsync/issue-43733.mir.stderr index c7b12a395a25..0f4b5936dd01 100644 --- a/src/test/ui/threads-sendsync/issue-43733.stderr +++ b/src/test/ui/threads-sendsync/issue-43733.mir.stderr @@ -7,10 +7,10 @@ LL | __KEY.get(Default::default) = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:21:5 + --> $DIR/issue-43733.rs:20:42 | -LL | std::thread::LocalKey::new(__getit); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/threads-sendsync/issue-43733.rs b/src/test/ui/threads-sendsync/issue-43733.rs index 4d81d0a5d209..5434140cd612 100644 --- a/src/test/ui/threads-sendsync/issue-43733.rs +++ b/src/test/ui/threads-sendsync/issue-43733.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + #![feature(thread_local)] #![feature(cfg_target_thread_local, thread_local_internals)] @@ -5,26 +8,24 @@ type Foo = std::cell::RefCell; #[cfg(target_thread_local)] #[thread_local] -static __KEY: std::thread::__FastLocalKeyInner = - std::thread::__FastLocalKeyInner::new(); +static __KEY: std::thread::__FastLocalKeyInner = std::thread::__FastLocalKeyInner::new(); #[cfg(not(target_thread_local))] -static __KEY: std::thread::__OsLocalKeyInner = - std::thread::__OsLocalKeyInner::new(); +static __KEY: std::thread::__OsLocalKeyInner = std::thread::__OsLocalKeyInner::new(); -fn __getit() -> std::option::Option<&'static Foo> -{ +fn __getit() -> std::option::Option<&'static Foo> { __KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe } -static FOO: std::thread::LocalKey = - std::thread::LocalKey::new(__getit); +static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); //~^ ERROR call to unsafe function is unsafe fn main() { FOO.with(|foo| println!("{}", foo.borrow())); std::thread::spawn(|| { FOO.with(|foo| *foo.borrow_mut() += "foo"); - }).join().unwrap(); + }) + .join() + .unwrap(); FOO.with(|foo| println!("{}", foo.borrow())); } diff --git a/src/test/ui/threads-sendsync/issue-43733.thir.stderr b/src/test/ui/threads-sendsync/issue-43733.thir.stderr new file mode 100644 index 000000000000..0f4b5936dd01 --- /dev/null +++ b/src/test/ui/threads-sendsync/issue-43733.thir.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-43733.rs:17:5 + | +LL | __KEY.get(Default::default) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-43733.rs:20:42 + | +LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/unsafe-const-fn.stderr b/src/test/ui/unsafe/unsafe-const-fn.mir.stderr similarity index 91% rename from src/test/ui/unsafe/unsafe-const-fn.stderr rename to src/test/ui/unsafe/unsafe-const-fn.mir.stderr index 370e1e673cf3..3031be720f02 100644 --- a/src/test/ui/unsafe/unsafe-const-fn.stderr +++ b/src/test/ui/unsafe/unsafe-const-fn.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-const-fn.rs:7:18 + --> $DIR/unsafe-const-fn.rs:10:18 | LL | const VAL: u32 = dummy(0xFFFF); | ^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/unsafe/unsafe-const-fn.rs b/src/test/ui/unsafe/unsafe-const-fn.rs index 3b4becf17a76..65e3acf30637 100644 --- a/src/test/ui/unsafe/unsafe-const-fn.rs +++ b/src/test/ui/unsafe/unsafe-const-fn.rs @@ -1,5 +1,8 @@ // 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 } diff --git a/src/test/ui/unsafe/unsafe-const-fn.thir.stderr b/src/test/ui/unsafe/unsafe-const-fn.thir.stderr new file mode 100644 index 000000000000..3031be720f02 --- /dev/null +++ b/src/test/ui/unsafe/unsafe-const-fn.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-const-fn.rs:10:18 + | +LL | const VAL: u32 = dummy(0xFFFF); + | ^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr b/src/test/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr new file mode 100644 index 000000000000..1d6fa4cbf407 --- /dev/null +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-called-from-safe.rs:7:5 + | +LL | f(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs b/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs index 5487a8ecc37f..df12e4415165 100644 --- a/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + unsafe fn f() { return; } fn main() { diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr b/src/test/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr new file mode 100644 index 000000000000..1d6fa4cbf407 --- /dev/null +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-called-from-safe.rs:7:5 + | +LL | f(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr b/src/test/ui/unsafe/unsafe-fn-used-as-value.mir.stderr similarity index 89% rename from src/test/ui/unsafe/unsafe-fn-used-as-value.stderr rename to src/test/ui/unsafe/unsafe-fn-used-as-value.mir.stderr index a7b73ec53429..b08a7109dda5 100644 --- a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.mir.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-used-as-value.rs:5:5 + --> $DIR/unsafe-fn-used-as-value.rs:8:5 | LL | x(); | ^^^ call to unsafe function diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.rs b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs index 59b814779305..2af0786617bc 100644 --- a/src/test/ui/unsafe/unsafe-fn-used-as-value.rs +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs @@ -1,3 +1,6 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + unsafe fn f() { return; } fn main() { diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.thir.stderr b/src/test/ui/unsafe/unsafe-fn-used-as-value.thir.stderr new file mode 100644 index 000000000000..b08a7109dda5 --- /dev/null +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-used-as-value.rs:8:5 + | +LL | x(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 8334bc68ae72..d46ff7c41e91 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,7 +7,7 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 1388; +const ROOT_ENTRY_LIMIT: usize = 1369; const ISSUES_ENTRY_LIMIT: usize = 2551; fn check_entries(path: &Path, bad: &mut bool) {