diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2023-10-26 16:13:20 +0000 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2024-01-05 09:30:27 +0000 |
| commit | 982b49494e7a50adb94eae42144cfa51229ac127 (patch) | |
| tree | 713f1ef55e8494d65722cd20feb415a98d47eed0 /tests/ui/unsafe | |
| parent | 5113ed28ea1451a13eae3a05dca0dbabfd56f587 (diff) | |
| download | rust-982b49494e7a50adb94eae42144cfa51229ac127.tar.gz rust-982b49494e7a50adb94eae42144cfa51229ac127.zip | |
Remove revisions for THIR unsafeck
This is to make the diff when stabilizing it easier to review.
Diffstat (limited to 'tests/ui/unsafe')
103 files changed, 115 insertions, 1093 deletions
diff --git a/tests/ui/unsafe/access_union_field.rs b/tests/ui/unsafe/access_union_field.rs index 5c4e695df58..4183119725e 100644 --- a/tests/ui/unsafe/access_union_field.rs +++ b/tests/ui/unsafe/access_union_field.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![allow(unused_variables)] union Foo { diff --git a/tests/ui/unsafe/access_union_field.mir.stderr b/tests/ui/unsafe/access_union_field.stderr index 98bc4077793..4c46bb44a1d 100644 --- a/tests/ui/unsafe/access_union_field.mir.stderr +++ b/tests/ui/unsafe/access_union_field.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:13:13 + --> $DIR/access_union_field.rs:10:13 | LL | let a = foo.bar; | ^^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | let a = foo.bar; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:14:13 + --> $DIR/access_union_field.rs:11:13 | LL | let b = foo.baz; | ^^^^^^^ access to union field diff --git a/tests/ui/unsafe/access_union_field.thir.stderr b/tests/ui/unsafe/access_union_field.thir.stderr deleted file mode 100644 index 98bc4077793..00000000000 --- a/tests/ui/unsafe/access_union_field.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:13:13 - | -LL | let a = foo.bar; - | ^^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:14:13 - | -LL | let b = foo.baz; - | ^^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs index 1b429955cb0..9e150326f0b 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs @@ -1,9 +1,6 @@ // edition: 2024 // compile-flags: -Zunstable-options // check-pass -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - #![crate_type = "lib"] #![deny(unused_unsafe)] @@ -11,8 +8,7 @@ unsafe fn unsf() {} unsafe fn foo() { unsf(); - //[mir]~^ WARN call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ WARN call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ WARN call to unsafe function is unsafe and requires unsafe block // no unused_unsafe unsafe { diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr index ea53bf59d31..9ca10b05090 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr @@ -1,12 +1,12 @@ warning: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13:5 + --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:10:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1 + --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:9:1 | LL | unsafe fn foo() { | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr deleted file mode 100644 index d63843ed2b3..00000000000 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1 - | -LL | unsafe fn foo() { - | ^^^^^^^^^^^^^^^ - = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.rs b/tests/ui/unsafe/foreign-unsafe-fn-called.rs index 67302ea1bcd..abbe462021e 100644 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.rs +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - mod test { extern "C" { pub fn free(); @@ -9,6 +6,5 @@ mod test { fn main() { test::free(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `test::free` is unsafe + //~^ ERROR call to unsafe function is unsafe } diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr index 5157dbb514b..b55e6130230 100644 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.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:11:5 + --> $DIR/foreign-unsafe-fn-called.rs:8:5 | LL | test::free(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr deleted file mode 100644 index 8c221314cd7..00000000000 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `test::free` 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/inline_asm.rs b/tests/ui/unsafe/inline_asm.rs index 12c7efe4f50..df45b8640c1 100644 --- a/tests/ui/unsafe/inline_asm.rs +++ b/tests/ui/unsafe/inline_asm.rs @@ -1,5 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // needs-asm-support use std::arch::asm; diff --git a/tests/ui/unsafe/inline_asm.mir.stderr b/tests/ui/unsafe/inline_asm.stderr index e38a9388a78..1e829152a72 100644 --- a/tests/ui/unsafe/inline_asm.mir.stderr +++ b/tests/ui/unsafe/inline_asm.stderr @@ -1,5 +1,5 @@ error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:8:5 + --> $DIR/inline_asm.rs:6:5 | LL | asm!("nop"); | ^^^^^^^^^^^ use of inline assembly diff --git a/tests/ui/unsafe/inline_asm.thir.stderr b/tests/ui/unsafe/inline_asm.thir.stderr deleted file mode 100644 index e38a9388a78..00000000000 --- a/tests/ui/unsafe/inline_asm.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:8:5 - | -LL | asm!("nop"); - | ^^^^^^^^^^^ use of inline assembly - | - = note: inline assembly is entirely unchecked and can cause undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-3080.rs b/tests/ui/unsafe/issue-3080.rs index 2b5269dda8f..883f3bfd24e 100644 --- a/tests/ui/unsafe/issue-3080.rs +++ b/tests/ui/unsafe/issue-3080.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - struct X(()); impl X { pub unsafe fn with(&self) { } diff --git a/tests/ui/unsafe/issue-3080.mir.stderr b/tests/ui/unsafe/issue-3080.stderr index a1ad98d205e..f84ba204639 100644 --- a/tests/ui/unsafe/issue-3080.mir.stderr +++ b/tests/ui/unsafe/issue-3080.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-3080.rs:10:5 + --> $DIR/issue-3080.rs:7:5 | LL | X(()).with(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/issue-3080.thir.stderr b/tests/ui/unsafe/issue-3080.thir.stderr deleted file mode 100644 index 1018218b1b0..00000000000 --- a/tests/ui/unsafe/issue-3080.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `X::with` 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs b/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs index 3e3da667c0b..7c4bde185fb 100644 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs +++ b/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs @@ -1,6 +1,4 @@ // Verify that unreachable code undergoes unsafety checks. -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck fn main() { return; diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr index e7960960774..cc1e73bb932 100644 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr +++ b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:7:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:5:5 | LL | *(1 as *mut u32) = 42; | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer @@ -7,7 +7,7 @@ LL | *(1 as *mut u32) = 42; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:17:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:15:5 | LL | *a = 1; | ^^^^^^ dereference of raw pointer @@ -15,7 +15,7 @@ LL | *a = 1; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:29:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:27:5 | LL | *b = 1; | ^^^^^^ dereference of raw pointer diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr deleted file mode 100644 index e81adad4507..00000000000 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:7:5 - | -LL | *(1 as *mut u32) = 42; - | ^^^^^^^^^^^^^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:17:5 - | -LL | *a = 1; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:29:5 - | -LL | *b = 1; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs index ac1cfd62a05..de275ff701a 100644 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs +++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - #[deny(unused_unsafe)] fn main() { let mut v = Vec::<i32>::with_capacity(24); diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr index 9e9cbcf33ae..321698e7636 100644 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.stderr +++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -1,5 +1,5 @@ error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:10:13 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:7:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -8,13 +8,13 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:4:8 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:1:8 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:12:38 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:9:38 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -23,7 +23,7 @@ LL | |w: &mut Vec<u32>| { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:16:34 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:13:34 | LL | unsafe { | ------ because it's nested under this `unsafe` block diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr deleted file mode 100644 index 2267da31512..00000000000 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:10:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | let f = |v: &mut Vec<_>| { -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:4:8 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:12:38 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | v.set_len(24); -LL | |w: &mut Vec<u32>| { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:16:34 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | |x: &mut Vec<u32>| { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 3 previous errors - diff --git a/tests/ui/unsafe/issue-47412.rs b/tests/ui/unsafe/issue-47412.rs index df6d6e4222e..2d1ea72280b 100644 --- a/tests/ui/unsafe/issue-47412.rs +++ b/tests/ui/unsafe/issue-47412.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #[derive(Copy, Clone)] enum Void {} diff --git a/tests/ui/unsafe/issue-47412.mir.stderr b/tests/ui/unsafe/issue-47412.stderr index 305f482e8c2..aebcbf07463 100644 --- a/tests/ui/unsafe/issue-47412.mir.stderr +++ b/tests/ui/unsafe/issue-47412.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:14:11 + --> $DIR/issue-47412.rs:11:11 | LL | match u.void {} | ^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | match u.void {} = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:20:11 + --> $DIR/issue-47412.rs:17:11 | LL | match *ptr {} | ^^^^ dereference of raw pointer diff --git a/tests/ui/unsafe/issue-47412.thir.stderr b/tests/ui/unsafe/issue-47412.thir.stderr deleted file mode 100644 index 305f482e8c2..00000000000 --- a/tests/ui/unsafe/issue-47412.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:14:11 - | -LL | match u.void {} - | ^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:20:11 - | -LL | match *ptr {} - | ^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs b/tests/ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs index 72f7b674777..b0d738855d7 100644 --- a/tests/ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs +++ b/tests/ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs @@ -1,6 +1,4 @@ // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // This is issue #85435. But the real story is reflected in issue #85561, where // a bug in the implementation of feature(capture_disjoint_fields) () was diff --git a/tests/ui/unsafe/issue-87414-query-cycle.rs b/tests/ui/unsafe/issue-87414-query-cycle.rs index 99e40ba4b4c..a004d739422 100644 --- a/tests/ui/unsafe/issue-87414-query-cycle.rs +++ b/tests/ui/unsafe/issue-87414-query-cycle.rs @@ -1,7 +1,6 @@ // Regression test for #87414. // check-pass -// compile-flags: -Zthir-unsafeck fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() } diff --git a/tests/ui/unsafe/ranged_ints.rs b/tests/ui/unsafe/ranged_ints.rs index 05efe87ba6e..0fa2da917e9 100644 --- a/tests/ui/unsafe/ranged_ints.rs +++ b/tests/ui/unsafe/ranged_ints.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints.mir.stderr b/tests/ui/unsafe/ranged_ints.stderr index ef00edae05d..b6875e15815 100644 --- a/tests/ui/unsafe/ranged_ints.mir.stderr +++ b/tests/ui/unsafe/ranged_ints.stderr @@ -1,5 +1,5 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints.rs:10:14 + --> $DIR/ranged_ints.rs:7:14 | LL | let _x = NonZero(0); | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr diff --git a/tests/ui/unsafe/ranged_ints.thir.stderr b/tests/ui/unsafe/ranged_ints.thir.stderr deleted file mode 100644 index ef00edae05d..00000000000 --- a/tests/ui/unsafe/ranged_ints.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints.rs:10:14 - | -LL | let _x = NonZero(0); - | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr - | - = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints2.rs b/tests/ui/unsafe/ranged_ints2.rs index ad9d598aba2..a3d9f54efe2 100644 --- a/tests/ui/unsafe/ranged_ints2.rs +++ b/tests/ui/unsafe/ranged_ints2.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.stderr index dc6bd72f56c..1885e77af7e 100644 --- a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints2.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:11:13 + --> $DIR/ranged_ints2.rs:8:13 | LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field @@ -7,7 +7,7 @@ LL | let y = &mut x.0; = note: mutating layout constrained fields cannot statically be checked for valid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:12:25 + --> $DIR/ranged_ints2.rs:9:25 | LL | if let Some(NonZero(ref mut y)) = Some(x) {} | ^^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr deleted file mode 100644 index dc6bd72f56c..00000000000 --- a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:11:13 - | -LL | let y = &mut x.0; - | ^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:12:25 - | -LL | if let Some(NonZero(ref mut y)) = Some(x) {} - | ^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints2_const.rs b/tests/ui/unsafe/ranged_ints2_const.rs index 56f5407bb6e..b7178c2b52b 100644 --- a/tests/ui/unsafe/ranged_ints2_const.rs +++ b/tests/ui/unsafe/ranged_ints2_const.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2_const.stderr index c16550a5800..a0dc950e76d 100644 --- a/tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints2_const.stderr @@ -1,5 +1,5 @@ error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:14:13 + --> $DIR/ranged_ints2_const.rs:11:13 | LL | let y = &mut x.0; | ^^^^^^^^ @@ -8,7 +8,7 @@ LL | let y = &mut x.0; = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:21:22 + --> $DIR/ranged_ints2_const.rs:18:22 | LL | let y = unsafe { &mut x.0 }; | ^^^^^^^^ @@ -17,7 +17,7 @@ LL | let y = unsafe { &mut x.0 }; = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:27:22 + --> $DIR/ranged_ints2_const.rs:24:22 | LL | unsafe { let y = &mut x.0; } | ^^^^^^^^ @@ -26,7 +26,7 @@ LL | unsafe { let y = &mut x.0; } = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2_const.rs:14:13 + --> $DIR/ranged_ints2_const.rs:11:13 | LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr deleted file mode 100644 index b3f139f7213..00000000000 --- a/tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2_const.rs:14:13 - | -LL | let y = &mut x.0; - | ^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:14:13 - | -LL | let y = &mut x.0; - | ^^^^^^^^ - | - = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:21:22 - | -LL | let y = unsafe { &mut x.0 }; - | ^^^^^^^^ - | - = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:27:22 - | -LL | unsafe { let y = &mut x.0; } - | ^^^^^^^^ - | - = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0133, E0658. -For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints3.rs b/tests/ui/unsafe/ranged_ints3.rs index 76d4bfe9530..47d67fac678 100644 --- a/tests/ui/unsafe/ranged_ints3.rs +++ b/tests/ui/unsafe/ranged_ints3.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] use std::cell::Cell; diff --git a/tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3.stderr index 72bce5de0ae..8dcb99fc16d 100644 --- a/tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints3.stderr @@ -1,5 +1,5 @@ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3.rs:13:13 + --> $DIR/ranged_ints3.rs:10:13 | LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability diff --git a/tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr deleted file mode 100644 index 72bce5de0ae..00000000000 --- a/tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3.rs:13:13 - | -LL | let y = &x.0; - | ^^^^ borrow of layout constrained field with interior mutability - | - = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints3_const.rs b/tests/ui/unsafe/ranged_ints3_const.rs index 637198d3604..c069ae7da02 100644 --- a/tests/ui/unsafe/ranged_ints3_const.rs +++ b/tests/ui/unsafe/ranged_ints3_const.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] use std::cell::Cell; diff --git a/tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_const.stderr index 62df9333069..215005571f6 100644 --- a/tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints3_const.stderr @@ -1,5 +1,5 @@ error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/ranged_ints3_const.rs:15:13 + --> $DIR/ranged_ints3_const.rs:12:13 | LL | let y = &x.0; | ^^^^ @@ -8,7 +8,7 @@ LL | let y = &x.0; = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/ranged_ints3_const.rs:22:22 + --> $DIR/ranged_ints3_const.rs:19:22 | LL | let y = unsafe { &x.0 }; | ^^^^ @@ -17,7 +17,7 @@ LL | let y = unsafe { &x.0 }; = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_const.rs:15:13 + --> $DIR/ranged_ints3_const.rs:12:13 | LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability diff --git a/tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr deleted file mode 100644 index 5dbc563aad2..00000000000 --- a/tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_const.rs:15:13 - | -LL | let y = &x.0; - | ^^^^ borrow of layout constrained field with interior mutability - | - = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values - -error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/ranged_ints3_const.rs:15:13 - | -LL | let y = &x.0; - | ^^^^ - | - = note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information - = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable - -error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/ranged_ints3_const.rs:22:22 - | -LL | let y = unsafe { &x.0 }; - | ^^^^ - | - = note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information - = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0133, E0658. -For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints3_match.rs b/tests/ui/unsafe/ranged_ints3_match.rs index d9fcf0bd665..de6be506d56 100644 --- a/tests/ui/unsafe/ranged_ints3_match.rs +++ b/tests/ui/unsafe/ranged_ints3_match.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] use std::cell::Cell; diff --git a/tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_match.stderr index 27c06640928..1bdc29d077c 100644 --- a/tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints3_match.stderr @@ -1,5 +1,5 @@ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_match.rs:14:17 + --> $DIR/ranged_ints3_match.rs:11:17 | LL | NonZero(ref x) => { x } | ^^^^^ borrow of layout constrained field with interior mutability @@ -7,7 +7,7 @@ LL | NonZero(ref x) => { x } = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_match.rs:20:23 + --> $DIR/ranged_ints3_match.rs:17:23 | LL | match y { NonZero(ref mut y) => { y } }; | ^^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr deleted file mode 100644 index 27c06640928..00000000000 --- a/tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_match.rs:14:17 - | -LL | NonZero(ref x) => { x } - | ^^^^^ borrow of layout constrained field with interior mutability - | - = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_match.rs:20:23 - | -LL | match y { NonZero(ref mut y) => { y } }; - | ^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints4.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4.mirunsafeck.stderr deleted file mode 100644 index 4f2f1e42e76..00000000000 --- a/tests/ui/unsafe/ranged_ints4.mirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4.rs:11:5 - | -LL | x.0 = 0; - | ^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints4.rs b/tests/ui/unsafe/ranged_ints4.rs index fe80af454cb..d8632c48434 100644 --- a/tests/ui/unsafe/ranged_ints4.rs +++ b/tests/ui/unsafe/ranged_ints4.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4.stderr index 4f2f1e42e76..4a703696b88 100644 --- a/tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints4.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4.rs:11:5 + --> $DIR/ranged_ints4.rs:8:5 | LL | x.0 = 0; | ^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints4_const.rs b/tests/ui/unsafe/ranged_ints4_const.rs index a43c8be71c4..f09168c3d3f 100644 --- a/tests/ui/unsafe/ranged_ints4_const.rs +++ b/tests/ui/unsafe/ranged_ints4_const.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4_const.stderr index a2a3ae668a2..604ec1167e4 100644 --- a/tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints4_const.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4_const.rs:13:5 + --> $DIR/ranged_ints4_const.rs:10:5 | LL | x.0 = 0; | ^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr deleted file mode 100644 index a2a3ae668a2..00000000000 --- a/tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4_const.rs:13:5 - | -LL | x.0 = 0; - | ^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints_const.rs b/tests/ui/unsafe/ranged_ints_const.rs index 472b0968150..8477772867e 100644 --- a/tests/ui/unsafe/ranged_ints_const.rs +++ b/tests/ui/unsafe/ranged_ints_const.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints_const.mir.stderr b/tests/ui/unsafe/ranged_ints_const.stderr index 563b9be2672..2b8be290d3a 100644 --- a/tests/ui/unsafe/ranged_ints_const.mir.stderr +++ b/tests/ui/unsafe/ranged_ints_const.stderr @@ -1,5 +1,5 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints_const.rs:11:34 + --> $DIR/ranged_ints_const.rs:8:34 | LL | const fn foo() -> NonZero<u32> { NonZero(0) } | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr diff --git a/tests/ui/unsafe/ranged_ints_const.thir.stderr b/tests/ui/unsafe/ranged_ints_const.thir.stderr deleted file mode 100644 index 563b9be2672..00000000000 --- a/tests/ui/unsafe/ranged_ints_const.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints_const.rs:11:34 - | -LL | const fn foo() -> NonZero<u32> { NonZero(0) } - | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr - | - = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints_macro.rs b/tests/ui/unsafe/ranged_ints_macro.rs index 8293d029951..0acc3e0f6b1 100644 --- a/tests/ui/unsafe/ranged_ints_macro.rs +++ b/tests/ui/unsafe/ranged_ints_macro.rs @@ -1,6 +1,4 @@ // build-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![feature(rustc_attrs)] diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs index db1e916a36c..eceac115edd 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - #![deny(unsafe_op_in_unsafe_fn)] #![deny(unused_unsafe)] @@ -10,8 +7,7 @@ static mut VOID: () = (); unsafe fn deny_level() { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ ERROR call to unsafe function is unsafe and requires unsafe block *PTR; //~^ ERROR dereference of raw pointer is unsafe and requires unsafe block VOID = (); @@ -26,8 +22,7 @@ unsafe fn deny_level() { #[deny(warnings)] unsafe fn warning_level() { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ ERROR call to unsafe function is unsafe and requires unsafe block *PTR; //~^ ERROR dereference of raw pointer is unsafe and requires unsafe block VOID = (); @@ -74,12 +69,10 @@ unsafe fn nested_allow_level() { fn main() { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ ERROR call to unsafe function is unsafe and requires unsafe block #[allow(unsafe_op_in_unsafe_fn)] { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block } } diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr index 0c0826c1cfb..d61d87cd001 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr @@ -1,23 +1,23 @@ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:12:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:9:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:1 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:8:1 | LL | unsafe fn deny_level() { | ^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:1:9 | LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:15:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:5 | LL | *PTR; | ^^^^ dereference of raw pointer @@ -25,7 +25,7 @@ LL | *PTR; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:17:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:13:5 | LL | VOID = (); | ^^^^^^^^^ use of mutable static @@ -33,38 +33,38 @@ LL | VOID = (); = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:20:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:16:5 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:5:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:2:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:24:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:1 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:23:1 | LL | unsafe fn warning_level() { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:8 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:22:8 | LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]` error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:5 | LL | *PTR; | ^^^^ dereference of raw pointer @@ -72,7 +72,7 @@ LL | *PTR; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 | LL | VOID = (); | ^^^^^^^^^ use of mutable static @@ -80,19 +80,19 @@ LL | VOID = (); = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:35:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:30:5 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:44:5 | LL | unsafe { unsafe { unsf() } } | ^^^^^^ unnecessary `unsafe` block error[E0133]: call to unsafe function is unsafe and requires unsafe block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:71:5 | LL | unsf(); | ^^^^^^ call to unsafe function @@ -100,7 +100,7 @@ LL | unsf(); = 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/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:75:9 | LL | unsf(); | ^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr deleted file mode 100644 index ad0621a1d04..00000000000 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr +++ /dev/null @@ -1,112 +0,0 @@ -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:12:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:1 - | -LL | unsafe fn deny_level() { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9 - | -LL | #![deny(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:15:5 - | -LL | *PTR; - | ^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:17:5 - | -LL | VOID = (); - | ^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:20:5 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:5:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:1 - | -LL | unsafe fn warning_level() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:8 - | -LL | #[deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]` - -error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5 - | -LL | *PTR; - | ^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5 - | -LL | VOID = (); - | ^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:35:5 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5 - | -LL | unsafe { unsafe { unsf() } } - | ^^^^^^ unnecessary `unsafe` block - -error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe function or block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 11 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/union-assignop.rs b/tests/ui/unsafe/union-assignop.rs index 5e667cd10d5..6122aef0565 100644 --- a/tests/ui/unsafe/union-assignop.rs +++ b/tests/ui/unsafe/union-assignop.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - use std::ops::AddAssign; use std::mem::ManuallyDrop; diff --git a/tests/ui/unsafe/union-assignop.mirunsafeck.stderr b/tests/ui/unsafe/union-assignop.stderr index 0ecd5203dd9..e3a673ee1ff 100644 --- a/tests/ui/unsafe/union-assignop.mirunsafeck.stderr +++ b/tests/ui/unsafe/union-assignop.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:19:5 + --> $DIR/union-assignop.rs:16:5 | LL | foo.a += 5; | ^^^^^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | foo.a += 5; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:20:6 + --> $DIR/union-assignop.rs:17:6 | LL | *foo.b += NonCopy; | ^^^^^ access to union field @@ -15,7 +15,7 @@ LL | *foo.b += NonCopy; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:21:6 + --> $DIR/union-assignop.rs:18:6 | LL | *foo.b = NonCopy; | ^^^^^ access to union field @@ -23,7 +23,7 @@ LL | *foo.b = NonCopy; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:23:5 + --> $DIR/union-assignop.rs:20:5 | LL | foo.a; | ^^^^^ access to union field @@ -31,7 +31,7 @@ LL | foo.a; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:25:5 + --> $DIR/union-assignop.rs:22:5 | LL | foo.b; | ^^^^^ access to union field @@ -39,7 +39,7 @@ LL | foo.b; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:27:13 + --> $DIR/union-assignop.rs:24:13 | LL | foo.b = foo.b; | ^^^^^ access to union field diff --git a/tests/ui/unsafe/union-assignop.thirunsafeck.stderr b/tests/ui/unsafe/union-assignop.thirunsafeck.stderr deleted file mode 100644 index 24b357e762b..00000000000 --- a/tests/ui/unsafe/union-assignop.thirunsafeck.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:19:5 - | -LL | foo.a += 5; - | ^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:20:6 - | -LL | *foo.b += NonCopy; - | ^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:21:6 - | -LL | *foo.b = NonCopy; - | ^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:23:5 - | -LL | foo.a; - | ^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:25:5 - | -LL | foo.b; - | ^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:27:13 - | -LL | foo.b = foo.b; - | ^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/union-modification.rs b/tests/ui/unsafe/union-modification.rs index 9a53ef90852..fbcb846be9d 100644 --- a/tests/ui/unsafe/union-modification.rs +++ b/tests/ui/unsafe/union-modification.rs @@ -1,7 +1,4 @@ // run-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - union Foo { bar: i8, _blah: isize, diff --git a/tests/ui/unsafe/union.rs b/tests/ui/unsafe/union.rs index 4338d78eabb..83ec1c3cd6c 100644 --- a/tests/ui/unsafe/union.rs +++ b/tests/ui/unsafe/union.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - union Foo { bar: i8, zst: (), @@ -29,9 +26,9 @@ pub fn main() { match foo { Foo { bar: _a } => {}, //~ ERROR access to union field is unsafe } - match foo { //[mir]~ ERROR access to union field is unsafe + match foo { //~ ERROR access to union field is unsafe Foo { - pizza: Pizza { //[thir]~ ERROR access to union field is unsafe + pizza: Pizza { topping: Some(PizzaTopping::Cheese) | Some(PizzaTopping::Pineapple) | None } } => {}, @@ -39,10 +36,10 @@ pub fn main() { // MIR unsafeck incorrectly thinks that no unsafe block is needed to do these match foo { - Foo { zst: () } => {}, //[thir]~ ERROR access to union field is unsafe + Foo { zst: () } => {}, } match foo { - Foo { pizza: Pizza { .. } } => {}, //[thir]~ ERROR access to union field is unsafe + Foo { pizza: Pizza { .. } } => {}, } // binding to wildcard is okay diff --git a/tests/ui/unsafe/union.mir.stderr b/tests/ui/unsafe/union.stderr index 787714cdd2d..fe814462412 100644 --- a/tests/ui/unsafe/union.mir.stderr +++ b/tests/ui/unsafe/union.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:30:20 + --> $DIR/union.rs:27:20 | LL | Foo { bar: _a } => {}, | ^^ access to union field @@ -7,7 +7,7 @@ LL | Foo { bar: _a } => {}, = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:32:11 + --> $DIR/union.rs:29:11 | LL | match foo { | ^^^ access to union field diff --git a/tests/ui/unsafe/union.thir.stderr b/tests/ui/unsafe/union.thir.stderr deleted file mode 100644 index e1a1bd634de..00000000000 --- a/tests/ui/unsafe/union.thir.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:30:20 - | -LL | Foo { bar: _a } => {}, - | ^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:34:20 - | -LL | pizza: Pizza { - | ____________________^ -LL | | topping: Some(PizzaTopping::Cheese) | Some(PizzaTopping::Pineapple) | None -LL | | } - | |_____________^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:42:20 - | -LL | Foo { zst: () } => {}, - | ^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:45:22 - | -LL | Foo { pizza: Pizza { .. } } => {}, - | ^^^^^^^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/union_access_through_block.rs b/tests/ui/unsafe/union_access_through_block.rs index e4c0976b826..8b28c33650e 100644 --- a/tests/ui/unsafe/union_access_through_block.rs +++ b/tests/ui/unsafe/union_access_through_block.rs @@ -1,7 +1,4 @@ // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #[derive(Copy, Clone)] pub struct Foo { a: bool } diff --git a/tests/ui/unsafe/union_destructure.rs b/tests/ui/unsafe/union_destructure.rs index 6c88344b5fd..85fd54c8145 100644 --- a/tests/ui/unsafe/union_destructure.rs +++ b/tests/ui/unsafe/union_destructure.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #[derive(Copy, Clone)] #[allow(dead_code)] @@ -32,13 +30,13 @@ fn main() { }; let u = Foo { bar: 9 }; - unsafe { //[mir]~ WARNING unnecessary `unsafe` block + unsafe { //~ WARNING unnecessary `unsafe` block match u { Foo { baz: Pie { .. } } => {}, }; } let u = Foo { bar: 10 }; - unsafe { //[mir]~ WARNING unnecessary `unsafe` block + unsafe { //~ WARNING unnecessary `unsafe` block match u { Foo { baz: Pie { slices: _, size: _ } } => {}, }; diff --git a/tests/ui/unsafe/union_destructure.mir.stderr b/tests/ui/unsafe/union_destructure.stderr index 818f5ce03b5..431521472e8 100644 --- a/tests/ui/unsafe/union_destructure.mir.stderr +++ b/tests/ui/unsafe/union_destructure.stderr @@ -1,5 +1,5 @@ warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:35:5 + --> $DIR/union_destructure.rs:33:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block @@ -7,7 +7,7 @@ LL | unsafe { = note: `#[warn(unused_unsafe)]` on by default warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:41:5 + --> $DIR/union_destructure.rs:39:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/unsafe/union_wild_or_wild.rs b/tests/ui/unsafe/union_wild_or_wild.rs index 52a0a7abf27..935de97f255 100644 --- a/tests/ui/unsafe/union_wild_or_wild.rs +++ b/tests/ui/unsafe/union_wild_or_wild.rs @@ -1,7 +1,4 @@ // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - union X { a: i8 } fn main() { diff --git a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs index c1a32764039..e060c58e408 100644 --- a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs +++ b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs @@ -1,6 +1,4 @@ // edition:2018 -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![deny(unused_unsafe)] diff --git a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr index 62199e5a2ec..ffadd90c64b 100644 --- a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr +++ b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -1,17 +1,17 @@ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:7:9 | LL | unsafe { async {}.await; } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:3:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:13:5 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:11:5 | LL | unsafe { println!("foo"); } | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr deleted file mode 100644 index 62199e5a2ec..00000000000 --- a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9 - | -LL | unsafe { async {}.await; } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:13:5 - | -LL | unsafe { println!("foo"); } - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 2 previous errors - diff --git a/tests/ui/unsafe/unsafe-assign.rs b/tests/ui/unsafe/unsafe-assign.rs index 15273165b5e..02ce238854d 100644 --- a/tests/ui/unsafe/unsafe-assign.rs +++ b/tests/ui/unsafe/unsafe-assign.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #![allow(unused,dead_code)] diff --git a/tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-assign.stderr index f8b55e0668d..1fa5d715c2e 100644 --- a/tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr +++ b/tests/ui/unsafe/unsafe-assign.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-assign.rs:12:5 + --> $DIR/unsafe-assign.rs:9:5 | LL | foo.0.0 = 0; | ^^^^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr deleted file mode 100644 index f8b55e0668d..00000000000 --- a/tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-assign.rs:12:5 - | -LL | foo.0.0 = 0; - | ^^^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-borrow.rs b/tests/ui/unsafe/unsafe-borrow.rs index 8dddc70be45..ab0e59489a9 100644 --- a/tests/ui/unsafe/unsafe-borrow.rs +++ b/tests/ui/unsafe/unsafe-borrow.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #![allow(unused,dead_code)] diff --git a/tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-borrow.stderr index a206722495a..a53b50583ca 100644 --- a/tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr +++ b/tests/ui/unsafe/unsafe-borrow.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:12:13 + --> $DIR/unsafe-borrow.rs:9:13 | LL | let a = &mut foo.0.0; | ^^^^^^^^^^^^ mutation of layout constrained field @@ -7,7 +7,7 @@ LL | let a = &mut foo.0.0; = note: mutating layout constrained fields cannot statically be checked for valid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:32:13 + --> $DIR/unsafe-borrow.rs:29:13 | LL | let a = &mut foo.0[2]; | ^^^^^^^^^^^^^ mutation of layout constrained field @@ -15,7 +15,7 @@ LL | let a = &mut foo.0[2]; = note: mutating layout constrained fields cannot statically be checked for valid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:51:18 + --> $DIR/unsafe-borrow.rs:48:18 | LL | NonZero((a,)) => *a = 0, | ^ mutation of layout constrained field diff --git a/tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr deleted file mode 100644 index a206722495a..00000000000 --- a/tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:12:13 - | -LL | let a = &mut foo.0.0; - | ^^^^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:32:13 - | -LL | let a = &mut foo.0[2]; - | ^^^^^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:51:18 - | -LL | NonZero((a,)) => *a = 0, - | ^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-const-fn.rs b/tests/ui/unsafe/unsafe-const-fn.rs index 65e3acf3063..3b4becf17a7 100644 --- a/tests/ui/unsafe/unsafe-const-fn.rs +++ b/tests/ui/unsafe/unsafe-const-fn.rs @@ -1,8 +1,5 @@ // 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/tests/ui/unsafe/unsafe-const-fn.mir.stderr b/tests/ui/unsafe/unsafe-const-fn.stderr index 2450f08664c..8d7f09a1edb 100644 --- a/tests/ui/unsafe/unsafe-const-fn.mir.stderr +++ b/tests/ui/unsafe/unsafe-const-fn.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-const-fn.rs:10:18 + --> $DIR/unsafe-const-fn.rs:7:18 | LL | const VAL: u32 = dummy(0xFFFF); | ^^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-const-fn.thir.stderr b/tests/ui/unsafe/unsafe-const-fn.thir.stderr deleted file mode 100644 index 199dca9237e..00000000000 --- a/tests/ui/unsafe/unsafe-const-fn.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `dummy` 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs index a94e94375ae..91264e790c8 100644 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs +++ b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - fn f(p: *mut u8) { *p = 0; //~ ERROR dereference of raw pointer is unsafe return; diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr index da3d5f3bd29..d79cbd466c2 100644 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5 + --> $DIR/unsafe-fn-assign-deref-ptr.rs:2:5 | LL | *p = 0; | ^^^^^^ dereference of raw pointer diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr deleted file mode 100644 index aa5644782a4..00000000000 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5 - | -LL | *p = 0; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.rs b/tests/ui/unsafe/unsafe-fn-called-from-safe.rs index 55072dcc6c3..1836629958a 100644 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.rs +++ b/tests/ui/unsafe/unsafe-fn-called-from-safe.rs @@ -1,10 +1,6 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - unsafe fn f() { return; } fn main() { f(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `f` is unsafe + //~^ ERROR call to unsafe function is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr index d3347437075..51aba0ba6d7 100644 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-called-from-safe.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:7:5 + --> $DIR/unsafe-fn-called-from-safe.rs:4:5 | LL | f(); | ^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr deleted file mode 100644 index 75431666186..00000000000 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `f` 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.rs b/tests/ui/unsafe/unsafe-fn-deref-ptr.rs index 4b7c6bf6985..a3144824323 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.rs +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - fn f(p: *const u8) -> u8 { let _ = *p; //~ ERROR dereference of raw pointer is unsafe let _: u8 = *p; //~ ERROR dereference of raw pointer is unsafe diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.stderr index 7f1e7c8902f..2e68963097e 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:5:13 + --> $DIR/unsafe-fn-deref-ptr.rs:2:13 | LL | let _ = *p; | ^^ dereference of raw pointer @@ -7,7 +7,7 @@ LL | let _ = *p; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:6:17 + --> $DIR/unsafe-fn-deref-ptr.rs:3:17 | LL | let _: u8 = *p; | ^^ dereference of raw pointer @@ -15,7 +15,7 @@ LL | let _: u8 = *p; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:7:9 + --> $DIR/unsafe-fn-deref-ptr.rs:4:9 | LL | _ = *p; | ^^ dereference of raw pointer @@ -23,7 +23,7 @@ LL | _ = *p; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:8:12 + --> $DIR/unsafe-fn-deref-ptr.rs:5:12 | LL | return *p; | ^^ dereference of raw pointer diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr deleted file mode 100644 index 7f1e7c8902f..00000000000 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:5:13 - | -LL | let _ = *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:6:17 - | -LL | let _: u8 = *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:7:9 - | -LL | _ = *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:8:12 - | -LL | return *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.rs b/tests/ui/unsafe/unsafe-fn-used-as-value.rs index 9517598c7ce..a47189d265f 100644 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.rs +++ b/tests/ui/unsafe/unsafe-fn-used-as-value.rs @@ -1,11 +1,7 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - unsafe fn f() { return; } fn main() { let x = f; x(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `f` is unsafe + //~^ ERROR call to unsafe function is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.stderr index 01e8e49ecfa..1625de184d2 100644 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-used-as-value.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:8:5 + --> $DIR/unsafe-fn-used-as-value.rs:5:5 | LL | x(); | ^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr deleted file mode 100644 index c38da7226f6..00000000000 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `f` 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-not-inherited.rs b/tests/ui/unsafe/unsafe-not-inherited.rs index f9d9a595714..6d797caa0f9 100644 --- a/tests/ui/unsafe/unsafe-not-inherited.rs +++ b/tests/ui/unsafe/unsafe-not-inherited.rs @@ -1,5 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(unused, dead_code)] static mut FOO: u64 = 0; diff --git a/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-not-inherited.stderr index 5536efbc6f4..3bc5ca5c9d1 100644 --- a/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr +++ b/tests/ui/unsafe/unsafe-not-inherited.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:8:31 + --> $DIR/unsafe-not-inherited.rs:6:31 | LL | unsafe {static BAR: u64 = FOO;} | ------ ^^^ use of mutable static @@ -9,7 +9,7 @@ LL | unsafe {static BAR: u64 = FOO;} = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:20:13 + --> $DIR/unsafe-not-inherited.rs:18:13 | LL | unsafe { | ------ items do not inherit unsafety from separate enclosing items diff --git a/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr deleted file mode 100644 index 88ea2e6d1fe..00000000000 --- a/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:8:31 - | -LL | unsafe {static BAR: u64 = FOO;} - | ------ ^^^ use of mutable static - | | - | items do not inherit unsafety from separate enclosing items - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: call to unsafe function `unsafe_call` is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:20:13 - | -LL | unsafe { - | ------ items do not inherit unsafety from separate enclosing items -... -LL | unsafe_call(); - | ^^^^^^^^^^^^^ 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/tests/ui/unsafe/unsafe-unstable-const-fn.rs b/tests/ui/unsafe/unsafe-unstable-const-fn.rs index 581b15cdfb0..5398721484a 100644 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.rs +++ b/tests/ui/unsafe/unsafe-unstable-const-fn.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![stable(feature = "foo", since = "1.33.0")] #![feature(staged_api)] diff --git a/tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr b/tests/ui/unsafe/unsafe-unstable-const-fn.stderr index 79133ab39a0..22a2dcbf119 100644 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr +++ b/tests/ui/unsafe/unsafe-unstable-const-fn.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-unstable-const-fn.rs:10:5 + --> $DIR/unsafe-unstable-const-fn.rs:7:5 | LL | *a == b | ^^ dereference of raw pointer diff --git a/tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr b/tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr deleted file mode 100644 index 79133ab39a0..00000000000 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-unstable-const-fn.rs:10:5 - | -LL | *a == b - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed index b59029df642..f776cffed59 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed @@ -1,7 +1,5 @@ // run-rustfix // aux-build:external_unsafe_macro.rs -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![deny(unsafe_op_in_unsafe_fn)] //~ NOTE #![crate_name = "wrapping_unsafe_block_sugg"] @@ -12,13 +10,11 @@ unsafe fn unsf() {} pub unsafe fn foo() { unsafe { //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE }} @@ -44,12 +40,10 @@ pub unsafe fn baz() -> i32 { unsafe { }} macro_rules! unsafe_macro { () => (unsf()) } -//[mir]~^ ERROR call to unsafe function is unsafe -//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe +//~^ ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE -//[mir]~| ERROR call to unsafe function is unsafe -//[thir]~| ERROR call to unsafe function `unsf` is unsafe +//~| ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs index 3629b8a1beb..13ab51ef432 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs @@ -1,7 +1,5 @@ // run-rustfix // aux-build:external_unsafe_macro.rs -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![deny(unsafe_op_in_unsafe_fn)] //~ NOTE #![crate_name = "wrapping_unsafe_block_sugg"] @@ -12,13 +10,11 @@ unsafe fn unsf() {} pub unsafe fn foo() { //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE } @@ -44,12 +40,10 @@ pub unsafe fn baz() -> i32 { } macro_rules! unsafe_macro { () => (unsf()) } -//[mir]~^ ERROR call to unsafe function is unsafe -//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe +//~^ ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE -//[mir]~| ERROR call to unsafe function is unsafe -//[thir]~| ERROR call to unsafe function `unsf` is unsafe +//~| ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr index 7a1b83c7367..9ae238d5a79 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr @@ -1,23 +1,23 @@ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:15:5 + --> $DIR/wrapping-unsafe-block-sugg.rs:13:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:13:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:11:1 | LL | pub unsafe fn foo() { | ^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/wrapping-unsafe-block-sugg.rs:6:9 + --> $DIR/wrapping-unsafe-block-sugg.rs:4:9 | LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:19:5 + --> $DIR/wrapping-unsafe-block-sugg.rs:16:5 | LL | unsf(); | ^^^^^^ call to unsafe function @@ -25,20 +25,20 @@ LL | unsf(); = note: consult the function's documentation for information on how to avoid undefined behavior error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:27:13 + --> $DIR/wrapping-unsafe-block-sugg.rs:23:13 | LL | let y = *x; | ^^ dereference of raw pointer | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:25:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:21:1 | LL | pub unsafe fn bar(x: *const i32) -> i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:30:9 + --> $DIR/wrapping-unsafe-block-sugg.rs:26:9 | LL | y + *x | ^^ dereference of raw pointer @@ -46,20 +46,20 @@ LL | y + *x = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:38:13 + --> $DIR/wrapping-unsafe-block-sugg.rs:34:13 | LL | let y = BAZ; | ^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:36:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:32:1 | LL | pub unsafe fn baz() -> i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:41:9 + --> $DIR/wrapping-unsafe-block-sugg.rs:37:9 | LL | y + BAZ | ^^^ use of mutable static @@ -67,7 +67,7 @@ LL | y + BAZ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:46:36 + --> $DIR/wrapping-unsafe-block-sugg.rs:42:36 | LL | macro_rules! unsafe_macro { () => (unsf()) } | ^^^^^^ call to unsafe function @@ -77,14 +77,14 @@ LL | unsafe_macro!(); | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:56:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:50:1 | LL | pub unsafe fn unsafe_in_macro() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:46:36 + --> $DIR/wrapping-unsafe-block-sugg.rs:42:36 | LL | macro_rules! unsafe_macro { () => (unsf()) } | ^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed deleted file mode 100644 index b59029df642..00000000000 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed +++ /dev/null @@ -1,73 +0,0 @@ -// run-rustfix -// aux-build:external_unsafe_macro.rs -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - -#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE -#![crate_name = "wrapping_unsafe_block_sugg"] - -extern crate external_unsafe_macro; - -unsafe fn unsf() {} - -pub unsafe fn foo() { unsafe { - //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE - //~| NOTE - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE - //~| NOTE -}} - -pub unsafe fn bar(x: *const i32) -> i32 { unsafe { - //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - let y = *x; //~ ERROR dereference of raw pointer is unsafe and requires unsafe block - //~^ NOTE - //~| NOTE - y + *x //~ ERROR dereference of raw pointer is unsafe and requires unsafe block - //~^ NOTE - //~| NOTE -}} - -static mut BAZ: i32 = 0; -pub unsafe fn baz() -> i32 { unsafe { - //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - let y = BAZ; //~ ERROR use of mutable static is unsafe and requires unsafe block - //~^ NOTE - //~| NOTE - y + BAZ //~ ERROR use of mutable static is unsafe and requires unsafe block - //~^ NOTE - //~| NOTE -}} - -macro_rules! unsafe_macro { () => (unsf()) } -//[mir]~^ ERROR call to unsafe function is unsafe -//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe -//~| NOTE -//~| NOTE -//[mir]~| ERROR call to unsafe function is unsafe -//[thir]~| ERROR call to unsafe function `unsf` is unsafe -//~| NOTE -//~| NOTE - -pub unsafe fn unsafe_in_macro() { unsafe { - //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsafe_macro!(); - //~^ NOTE - //~| NOTE - unsafe_macro!(); - //~^ NOTE - //~| NOTE -}} - -pub unsafe fn unsafe_in_external_macro() { - // FIXME: https://github.com/rust-lang/rust/issues/112504 - // FIXME: ~^ NOTE an unsafe function restricts its caller, but its body is safe by default - external_unsafe_macro::unsafe_macro!(); - external_unsafe_macro::unsafe_macro!(); -} - -fn main() {} diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr deleted file mode 100644 index b1fb35f85a6..00000000000 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr +++ /dev/null @@ -1,99 +0,0 @@ -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:15:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:13:1 - | -LL | pub unsafe fn foo() { - | ^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/wrapping-unsafe-block-sugg.rs:6:9 - | -LL | #![deny(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:19:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:27:13 - | -LL | let y = *x; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:25:1 - | -LL | pub unsafe fn bar(x: *const i32) -> i32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:30:9 - | -LL | y + *x - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:38:13 - | -LL | let y = BAZ; - | ^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:36:1 - | -LL | pub unsafe fn baz() -> i32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:41:9 - | -LL | y + BAZ - | ^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:46:36 - | -LL | macro_rules! unsafe_macro { () => (unsf()) } - | ^^^^^^ call to unsafe function -... -LL | unsafe_macro!(); - | --------------- in this macro invocation - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:56:1 - | -LL | pub unsafe fn unsafe_in_macro() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:46:36 - | -LL | macro_rules! unsafe_macro { () => (unsf()) } - | ^^^^^^ call to unsafe function -... -LL | unsafe_macro!(); - | --------------- in this macro invocation - | - = note: consult the function's documentation for information on how to avoid undefined behavior - = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 8 previous errors - |
