about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr (renamed from src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr)8
-rw-r--r--src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs2
-rw-r--r--src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr35
-rw-r--r--src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr (renamed from src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr)4
-rw-r--r--src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs3
-rw-r--r--src/test/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr19
-rw-r--r--src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr (renamed from src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr)2
-rw-r--r--src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs3
-rw-r--r--src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr11
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr (renamed from src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr)4
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs3
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr19
-rw-r--r--src/test/ui/error-codes/E0133.mir.stderr (renamed from src/test/ui/error-codes/E0133.stderr)2
-rw-r--r--src/test/ui/error-codes/E0133.rs3
-rw-r--r--src/test/ui/error-codes/E0133.thir.stderr (renamed from src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr)2
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_fn_transmute.mir.stderr (renamed from src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr)24
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs3
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr118
-rw-r--r--src/test/ui/foreign-unsafe-fn-called.mir.stderr (renamed from src/test/ui/foreign-unsafe-fn-called.stderr)2
-rw-r--r--src/test/ui/foreign-unsafe-fn-called.rs3
-rw-r--r--src/test/ui/foreign-unsafe-fn-called.thir.stderr11
-rw-r--r--src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr (renamed from src/test/ui/intrinsics/unchecked_math_unsafe.stderr)6
-rw-r--r--src/test/ui/intrinsics/unchecked_math_unsafe.rs3
-rw-r--r--src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr27
-rw-r--r--src/test/ui/issues/issue-28776.mir.stderr (renamed from src/test/ui/issues/issue-28776.stderr)2
-rw-r--r--src/test/ui/issues/issue-28776.rs3
-rw-r--r--src/test/ui/issues/issue-28776.thir.stderr11
-rw-r--r--src/test/ui/issues/issue-3080.mir.stderr (renamed from src/test/ui/issues/issue-3080.stderr)2
-rw-r--r--src/test/ui/issues/issue-3080.rs3
-rw-r--r--src/test/ui/issues/issue-3080.thir.stderr11
-rw-r--r--src/test/ui/issues/issue-5844.mir.stderr (renamed from src/test/ui/issues/issue-5844.stderr)2
-rw-r--r--src/test/ui/issues/issue-5844.rs2
-rw-r--r--src/test/ui/issues/issue-5844.thir.stderr11
-rw-r--r--src/test/ui/threads-sendsync/issue-43733.mir.stderr (renamed from src/test/ui/threads-sendsync/issue-43733.stderr)6
-rw-r--r--src/test/ui/threads-sendsync/issue-43733.rs19
-rw-r--r--src/test/ui/threads-sendsync/issue-43733.thir.stderr19
-rw-r--r--src/test/ui/unsafe/unsafe-const-fn.mir.stderr (renamed from src/test/ui/unsafe/unsafe-const-fn.stderr)2
-rw-r--r--src/test/ui/unsafe/unsafe-const-fn.rs3
-rw-r--r--src/test/ui/unsafe/unsafe-const-fn.thir.stderr11
-rw-r--r--src/test/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr11
-rw-r--r--src/test/ui/unsafe/unsafe-fn-called-from-safe.rs3
-rw-r--r--src/test/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr11
-rw-r--r--src/test/ui/unsafe/unsafe-fn-used-as-value.mir.stderr (renamed from src/test/ui/unsafe/unsafe-fn-used-as-value.stderr)2
-rw-r--r--src/test/ui/unsafe/unsafe-fn-used-as-value.rs3
-rw-r--r--src/test/ui/unsafe/unsafe-fn-used-as-value.thir.stderr11
45 files changed, 421 insertions, 44 deletions
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
index c95fe173488..d22413beecb 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 ccc1b8553f0..2ed343b4a07 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 00000000000..d22413beecb
--- /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
index 190b4792ebc..2f9c7973b5a 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 76a0f291410..bdb3eb23c38 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 00000000000..2f9c7973b5a
--- /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
index a1fb1c02e46..a60100ddaea 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 36777693fab..57358fbdd84 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 00000000000..a60100ddaea
--- /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
index 5196b8ee0a2..b643ecc0ce8 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 71e6c2cb858..1ce78147970 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 00000000000..b643ecc0ce8
--- /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
index 1eb696506f3..b11d5e2c2fc 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 52494ce6078..dee1475ba21 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
index 80d2c6ced24..b11d5e2c2fc 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
index 08ba14dc40e..04efea0b230 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 9007e501bc2..9a45dbc51d4 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 00000000000..04efea0b230
--- /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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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
index afc9632de7c..d3cf5d84fdd 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 abbe462021e..de3de286fc9 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 00000000000..d3cf5d84fdd
--- /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
index 4066cf8efb8..26b2f9f2713 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 a034b45f530..98d3a11ad02 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 00000000000..26b2f9f2713
--- /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
index 7faac88e26a..1d470fb5e0f 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 e564ebcd110..19df3c4a425 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 00000000000..1d470fb5e0f
--- /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
index 138d6df679f..f395c30b815 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 883f3bfd24e..2b5269dda8f 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 00000000000..f395c30b815
--- /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
index ed5a3dc6b1e..6134d6889ff 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 b855e87e3f5..4f90a9c6645 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 00000000000..6134d6889ff
--- /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
index c7b12a395a2..0f4b5936dd0 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<Foo> = 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 4d81d0a5d20..5434140cd61 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<String>;
 
 #[cfg(target_thread_local)]
 #[thread_local]
-static __KEY: std::thread::__FastLocalKeyInner<Foo> =
-    std::thread::__FastLocalKeyInner::new();
+static __KEY: std::thread::__FastLocalKeyInner<Foo> = std::thread::__FastLocalKeyInner::new();
 
 #[cfg(not(target_thread_local))]
-static __KEY: std::thread::__OsLocalKeyInner<Foo> =
-    std::thread::__OsLocalKeyInner::new();
+static __KEY: std::thread::__OsLocalKeyInner<Foo> = 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<Foo> =
-    std::thread::LocalKey::new(__getit);
+static FOO: std::thread::LocalKey<Foo> = 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 00000000000..0f4b5936dd0
--- /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<Foo> = 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
index 370e1e673cf..3031be720f0 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 3b4becf17a7..65e3acf3063 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 00000000000..3031be720f0
--- /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 00000000000..1d6fa4cbf40
--- /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 5487a8ecc37..df12e441516 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 00000000000..1d6fa4cbf40
--- /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
index a7b73ec5342..b08a7109dda 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 59b81477930..2af0786617b 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 00000000000..b08a7109dda
--- /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`.