From 982b49494e7a50adb94eae42144cfa51229ac127 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 26 Oct 2023 16:13:20 +0000 Subject: Remove revisions for THIR unsafeck This is to make the diff when stabilizing it easier to review. --- tests/ui/asm/aarch64/const.rs | 2 - tests/ui/asm/bad-arch.mirunsafeck.stderr | 17 - tests/ui/asm/bad-arch.rs | 2 - tests/ui/asm/bad-arch.stderr | 17 + tests/ui/asm/bad-arch.thirunsafeck.stderr | 17 - tests/ui/asm/bad-template.aarch64.stderr | 202 +++ .../ui/asm/bad-template.aarch64_mirunsafeck.stderr | 202 --- .../asm/bad-template.aarch64_thirunsafeck.stderr | 202 --- tests/ui/asm/bad-template.rs | 22 +- tests/ui/asm/bad-template.x86_64.stderr | 202 +++ .../ui/asm/bad-template.x86_64_mirunsafeck.stderr | 202 --- .../ui/asm/bad-template.x86_64_thirunsafeck.stderr | 202 --- tests/ui/asm/x86_64/const.rs | 2 - tests/ui/async-await/async-await.rs | 3 +- .../async-unsafe-fn-call-in-safe.mir.stderr | 35 - .../ui/async-await/async-unsafe-fn-call-in-safe.rs | 14 +- .../async-unsafe-fn-call-in-safe.stderr | 35 + .../async-unsafe-fn-call-in-safe.thir.stderr | 35 - .../closure_no_cap_coerce_many_unsafe_0.mir.stderr | 19 - .../closure_no_cap_coerce_many_unsafe_0.rs | 3 - .../closure_no_cap_coerce_many_unsafe_0.stderr | 19 + ...closure_no_cap_coerce_many_unsafe_0.thir.stderr | 19 - ...erce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr | 11 - .../coerce-unsafe-closure-to-unsafe-fn-ptr.rs | 3 - .../coerce-unsafe-closure-to-unsafe-fn-ptr.stderr | 11 + ...rce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr | 11 - tests/ui/closures/thir-unsafeck-issue-85871.rs | 1 - tests/ui/command/command-pre-exec.rs | 2 - .../const-extern-fn-requires-unsafe.rs | 9 +- .../const-extern-fn-requires-unsafe.stderr | 19 + tests/ui/consts/issue-16538.mir.stderr | 29 - tests/ui/consts/issue-16538.rs | 3 - tests/ui/consts/issue-16538.stderr | 29 + tests/ui/consts/issue-16538.thir.stderr | 29 - .../issue-45729-unsafe-in-coroutine.mir.stderr | 11 - .../coroutine/issue-45729-unsafe-in-coroutine.rs | 3 - .../issue-45729-unsafe-in-coroutine.stderr | 11 + .../issue-45729-unsafe-in-coroutine.thir.stderr | 11 - .../coroutine/static-mut-reference-across-yield.rs | 2 - tests/ui/error-codes/E0133.mir.stderr | 11 - tests/ui/error-codes/E0133.rs | 3 - tests/ui/error-codes/E0133.stderr | 11 + tests/ui/error-codes/E0133.thir.stderr | 11 - tests/ui/extern/issue-28324.mir.stderr | 11 - tests/ui/extern/issue-28324.rs | 3 - tests/ui/extern/issue-28324.stderr | 11 + tests/ui/extern/issue-28324.thir.stderr | 11 - tests/ui/inline-const/expr-unsafe-err.mir.stderr | 11 - tests/ui/inline-const/expr-unsafe-err.rs | 6 +- tests/ui/inline-const/expr-unsafe-err.stderr | 11 + tests/ui/inline-const/expr-unsafe-err.thir.stderr | 11 - tests/ui/inline-const/expr-unsafe.mir.stderr | 14 - tests/ui/inline-const/expr-unsafe.rs | 3 +- tests/ui/inline-const/expr-unsafe.stderr | 14 + tests/ui/inline-const/expr-unsafe.thir.stderr | 14 - tests/ui/inline-const/pat-unsafe-err.rs | 4 +- tests/ui/inline-const/pat-unsafe-err.thir.stderr | 19 - tests/ui/inline-const/pat-unsafe.rs | 4 +- tests/ui/inline-const/pat-unsafe.thir.stderr | 20 - tests/ui/intrinsics/issue-28575.mir.stderr | 11 - tests/ui/intrinsics/issue-28575.rs | 3 - tests/ui/intrinsics/issue-28575.stderr | 11 + tests/ui/intrinsics/issue-28575.thir.stderr | 11 - .../ui/intrinsics/unchecked_math_unsafe.mir.stderr | 27 - tests/ui/intrinsics/unchecked_math_unsafe.rs | 3 - tests/ui/intrinsics/unchecked_math_unsafe.stderr | 27 + .../intrinsics/unchecked_math_unsafe.thir.stderr | 27 - tests/ui/issues/issue-11740.rs | 2 - tests/ui/issues/issue-28776.mir.stderr | 11 - tests/ui/issues/issue-28776.rs | 3 - tests/ui/issues/issue-28776.stderr | 11 + tests/ui/issues/issue-28776.thir.stderr | 11 - tests/ui/issues/issue-39367.rs | 2 - tests/ui/issues/issue-48131.mir.stderr | 20 - tests/ui/issues/issue-48131.rs | 3 - tests/ui/issues/issue-48131.stderr | 20 + tests/ui/issues/issue-48131.thir.stderr | 20 - tests/ui/issues/issue-5844.mir.stderr | 11 - tests/ui/issues/issue-5844.rs | 4 +- tests/ui/issues/issue-5844.stderr | 11 + tests/ui/issues/issue-5844.thir.stderr | 11 - tests/ui/lto/lto-still-runs-thread-dtors.rs | 2 - .../pattern/non-structural-match-types.mir.stderr | 14 - tests/ui/pattern/non-structural-match-types.rs | 2 - tests/ui/pattern/non-structural-match-types.stderr | 14 + .../pattern/non-structural-match-types.thir.stderr | 14 - tests/ui/process/no-stdio.rs | 2 - .../rfcs/rfc-2396-target_feature-11/check-pass.rs | 2 - .../closures-inherit-target_feature.rs | 6 +- tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs | 2 - .../rfcs/rfc-2396-target_feature-11/fn-ptr.stderr | 23 + .../issue-108655-inline-always-closure.rs | 2 - .../rfcs/rfc-2396-target_feature-11/safe-calls.rs | 39 +- .../rfc-2396-target_feature-11/safe-calls.stderr | 115 ++ tests/ui/runtime/running-with-no-runtime.rs | 2 - tests/ui/simd/intrinsic/generic-comparison-pass.rs | 2 - tests/ui/span/lint-unused-unsafe.mir.stderr | 1402 -------------------- tests/ui/span/lint-unused-unsafe.rs | 3 - tests/ui/span/lint-unused-unsafe.stderr | 1402 ++++++++++++++++++++ tests/ui/span/lint-unused-unsafe.thir.stderr | 1402 -------------------- tests/ui/static/safe-extern-statics-mut.mir.stderr | 35 - tests/ui/static/safe-extern-statics-mut.rs | 2 - tests/ui/static/safe-extern-statics-mut.stderr | 35 + .../ui/static/safe-extern-statics-mut.thir.stderr | 35 - tests/ui/static/safe-extern-statics.mir.stderr | 35 - tests/ui/static/safe-extern-statics.rs | 2 - tests/ui/static/safe-extern-statics.stderr | 35 + tests/ui/static/safe-extern-statics.thir.stderr | 35 - .../static-mut-foreign-requires-unsafe.mir.stderr | 27 - .../static/static-mut-foreign-requires-unsafe.rs | 3 - .../static-mut-foreign-requires-unsafe.stderr | 27 + .../static-mut-foreign-requires-unsafe.thir.stderr | 27 - .../static/static-mut-requires-unsafe.mir.stderr | 27 - tests/ui/static/static-mut-requires-unsafe.rs | 3 - tests/ui/static/static-mut-requires-unsafe.stderr | 27 + .../static/static-mut-requires-unsafe.thir.stderr | 27 - tests/ui/statics/issue-14227.mir.stderr | 11 - tests/ui/statics/issue-14227.rs | 3 - tests/ui/statics/issue-14227.stderr | 11 + tests/ui/statics/issue-14227.thir.stderr | 11 - .../ui/thread-local/thread-local-static.mir.stderr | 44 - tests/ui/thread-local/thread-local-static.rs | 2 - tests/ui/thread-local/thread-local-static.stderr | 44 + .../thread-local/thread-local-static.thir.stderr | 44 - tests/ui/threads-sendsync/issue-43733.mir.stderr | 19 - tests/ui/threads-sendsync/issue-43733.rs | 8 +- tests/ui/threads-sendsync/issue-43733.stderr | 19 + tests/ui/threads-sendsync/issue-43733.thir.stderr | 19 - tests/ui/traits/safety-fn-body.mir.stderr | 11 - tests/ui/traits/safety-fn-body.rs | 3 - tests/ui/traits/safety-fn-body.stderr | 11 + tests/ui/traits/safety-fn-body.thir.stderr | 11 - tests/ui/union/union-align.rs | 2 - tests/ui/union/union-backcomp.rs | 2 - tests/ui/union/union-basic.rs | 2 - ...n-borrow-move-parent-sibling.mirunsafeck.stderr | 84 -- tests/ui/union/union-borrow-move-parent-sibling.rs | 3 - .../union/union-borrow-move-parent-sibling.stderr | 84 ++ ...-borrow-move-parent-sibling.thirunsafeck.stderr | 84 -- tests/ui/union/union-const-codegen.rs | 2 - tests/ui/union/union-const-eval-field.rs | 2 - tests/ui/union/union-const-eval.rs | 2 - tests/ui/union/union-deref.mirunsafeck.stderr | 56 - tests/ui/union/union-deref.rs | 3 - tests/ui/union/union-deref.stderr | 56 + tests/ui/union/union-deref.thirunsafeck.stderr | 56 - .../ui/union/union-derive-clone.mirunsafeck.stderr | 45 - tests/ui/union/union-derive-clone.rs | 3 - tests/ui/union/union-derive-clone.stderr | 45 + .../union/union-derive-clone.thirunsafeck.stderr | 45 - tests/ui/union/union-derive-eq.mirunsafeck.stderr | 21 - tests/ui/union/union-derive-eq.rs | 3 - tests/ui/union/union-derive-eq.stderr | 21 + tests/ui/union/union-derive-eq.thirunsafeck.stderr | 21 - tests/ui/union/union-derive-rpass.rs | 2 - tests/ui/union/union-drop.rs | 2 - tests/ui/union/union-fields-1.mirunsafeck.stderr | 42 - tests/ui/union/union-fields-1.rs | 3 - tests/ui/union/union-fields-1.stderr | 42 + tests/ui/union/union-fields-1.thirunsafeck.stderr | 42 - tests/ui/union/union-fields-2.mirunsafeck.stderr | 84 -- tests/ui/union/union-fields-2.rs | 3 - tests/ui/union/union-fields-2.stderr | 84 ++ tests/ui/union/union-fields-2.thirunsafeck.stderr | 84 -- tests/ui/union/union-generic-rpass.rs | 3 - tests/ui/union/union-generic.mirunsafeck.stderr | 27 - tests/ui/union/union-generic.rs | 3 - tests/ui/union/union-generic.stderr | 27 + tests/ui/union/union-generic.thirunsafeck.stderr | 27 - tests/ui/union/union-inherent-method.rs | 2 - .../union/union-lint-dead-code.mirunsafeck.stderr | 17 - tests/ui/union/union-lint-dead-code.rs | 3 - tests/ui/union/union-lint-dead-code.stderr | 17 + .../union/union-lint-dead-code.thirunsafeck.stderr | 17 - tests/ui/union/union-macro.rs | 2 - tests/ui/union/union-manuallydrop-rpass.rs | 7 +- tests/ui/union/union-move.mirunsafeck.stderr | 51 - tests/ui/union/union-move.rs | 3 - tests/ui/union/union-move.stderr | 51 + tests/ui/union/union-move.thirunsafeck.stderr | 51 - tests/ui/union/union-nodrop.rs | 16 +- tests/ui/union/union-nonzero.rs | 2 - tests/ui/union/union-overwrite.rs | 2 - tests/ui/union/union-packed.rs | 2 - tests/ui/union/union-pat-refutability.rs | 7 +- .../union/union-suggest-field.mirunsafeck.stderr | 37 - tests/ui/union/union-suggest-field.rs | 3 - tests/ui/union/union-suggest-field.stderr | 37 + .../union/union-suggest-field.thirunsafeck.stderr | 37 - tests/ui/union/union-trait-impl.rs | 2 - tests/ui/union/union-transmute.rs | 2 - tests/ui/union/union-unsafe.mir.stderr | 83 -- tests/ui/union/union-unsafe.rs | 4 - tests/ui/union/union-unsafe.stderr | 83 ++ tests/ui/union/union-unsafe.thir.stderr | 83 -- tests/ui/union/union-unsized.mirunsafeck.stderr | 64 - tests/ui/union/union-unsized.rs | 3 - tests/ui/union/union-unsized.stderr | 76 ++ tests/ui/union/union-unsized.thirunsafeck.stderr | 64 - .../union-with-drop-fields.mirunsafeck.stderr | 39 - tests/ui/union/union-with-drop-fields.rs | 3 - tests/ui/union/union-with-drop-fields.stderr | 39 + .../union-with-drop-fields.thirunsafeck.stderr | 39 - tests/ui/unsafe/access_union_field.mir.stderr | 19 - tests/ui/unsafe/access_union_field.rs | 3 - tests/ui/unsafe/access_union_field.stderr | 19 + tests/ui/unsafe/access_union_field.thir.stderr | 19 - .../edition-2024-unsafe_op_in_unsafe_fn.mir.stderr | 16 - .../unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs | 6 +- .../edition-2024-unsafe_op_in_unsafe_fn.stderr | 16 + ...edition-2024-unsafe_op_in_unsafe_fn.thir.stderr | 16 - .../ui/unsafe/foreign-unsafe-fn-called.mir.stderr | 11 - tests/ui/unsafe/foreign-unsafe-fn-called.rs | 6 +- tests/ui/unsafe/foreign-unsafe-fn-called.stderr | 11 + .../ui/unsafe/foreign-unsafe-fn-called.thir.stderr | 11 - tests/ui/unsafe/inline_asm.mir.stderr | 11 - tests/ui/unsafe/inline_asm.rs | 2 - tests/ui/unsafe/inline_asm.stderr | 11 + tests/ui/unsafe/inline_asm.thir.stderr | 11 - tests/ui/unsafe/issue-3080.mir.stderr | 11 - tests/ui/unsafe/issue-3080.rs | 3 - tests/ui/unsafe/issue-3080.stderr | 11 + tests/ui/unsafe/issue-3080.thir.stderr | 11 - .../issue-45087-unreachable-unsafe.mir.stderr | 27 - tests/ui/unsafe/issue-45087-unreachable-unsafe.rs | 2 - .../unsafe/issue-45087-unreachable-unsafe.stderr | 27 + .../issue-45087-unreachable-unsafe.thir.stderr | 27 - ...-45107-unnecessary-unsafe-in-closure.mir.stderr | 35 - .../issue-45107-unnecessary-unsafe-in-closure.rs | 3 - ...ssue-45107-unnecessary-unsafe-in-closure.stderr | 35 + ...45107-unnecessary-unsafe-in-closure.thir.stderr | 35 - tests/ui/unsafe/issue-47412.mir.stderr | 19 - tests/ui/unsafe/issue-47412.rs | 3 - tests/ui/unsafe/issue-47412.stderr | 19 + tests/ui/unsafe/issue-47412.thir.stderr | 19 - ...-unsafe-op-in-let-under-unsafe-under-closure.rs | 2 - tests/ui/unsafe/issue-87414-query-cycle.rs | 1 - tests/ui/unsafe/ranged_ints.mir.stderr | 11 - tests/ui/unsafe/ranged_ints.rs | 3 - tests/ui/unsafe/ranged_ints.stderr | 11 + tests/ui/unsafe/ranged_ints.thir.stderr | 11 - tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr | 19 - tests/ui/unsafe/ranged_ints2.rs | 3 - tests/ui/unsafe/ranged_ints2.stderr | 19 + tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr | 19 - .../unsafe/ranged_ints2_const.mirunsafeck.stderr | 39 - tests/ui/unsafe/ranged_ints2_const.rs | 3 - tests/ui/unsafe/ranged_ints2_const.stderr | 39 + .../unsafe/ranged_ints2_const.thirunsafeck.stderr | 39 - tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints3.rs | 3 - tests/ui/unsafe/ranged_ints3.stderr | 11 + tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr | 11 - .../unsafe/ranged_ints3_const.mirunsafeck.stderr | 30 - tests/ui/unsafe/ranged_ints3_const.rs | 3 - tests/ui/unsafe/ranged_ints3_const.stderr | 30 + .../unsafe/ranged_ints3_const.thirunsafeck.stderr | 30 - .../unsafe/ranged_ints3_match.mirunsafeck.stderr | 19 - tests/ui/unsafe/ranged_ints3_match.rs | 3 - tests/ui/unsafe/ranged_ints3_match.stderr | 19 + .../unsafe/ranged_ints3_match.thirunsafeck.stderr | 19 - tests/ui/unsafe/ranged_ints4.mirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints4.rs | 3 - tests/ui/unsafe/ranged_ints4.stderr | 11 + tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr | 11 - .../unsafe/ranged_ints4_const.mirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints4_const.rs | 3 - tests/ui/unsafe/ranged_ints4_const.stderr | 11 + .../unsafe/ranged_ints4_const.thirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints_const.mir.stderr | 11 - tests/ui/unsafe/ranged_ints_const.rs | 3 - tests/ui/unsafe/ranged_ints_const.stderr | 11 + tests/ui/unsafe/ranged_ints_const.thir.stderr | 11 - tests/ui/unsafe/ranged_ints_macro.rs | 2 - .../rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr | 112 -- tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs | 15 +- .../unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr | 112 ++ .../rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr | 112 -- tests/ui/unsafe/union-assignop.mirunsafeck.stderr | 51 - tests/ui/unsafe/union-assignop.rs | 3 - tests/ui/unsafe/union-assignop.stderr | 51 + tests/ui/unsafe/union-assignop.thirunsafeck.stderr | 51 - tests/ui/unsafe/union-modification.rs | 3 - tests/ui/unsafe/union.mir.stderr | 19 - tests/ui/unsafe/union.rs | 11 +- tests/ui/unsafe/union.stderr | 19 + tests/ui/unsafe/union.thir.stderr | 38 - tests/ui/unsafe/union_access_through_block.rs | 3 - tests/ui/unsafe/union_destructure.mir.stderr | 16 - tests/ui/unsafe/union_destructure.rs | 6 +- tests/ui/unsafe/union_destructure.stderr | 16 + tests/ui/unsafe/union_wild_or_wild.rs | 3 - ...afe-around-compiler-generated-unsafe.mir.stderr | 20 - .../unsafe-around-compiler-generated-unsafe.rs | 2 - .../unsafe-around-compiler-generated-unsafe.stderr | 20 + ...fe-around-compiler-generated-unsafe.thir.stderr | 20 - tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr | 11 - tests/ui/unsafe/unsafe-assign.rs | 3 - tests/ui/unsafe/unsafe-assign.stderr | 11 + tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr | 11 - tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr | 27 - tests/ui/unsafe/unsafe-borrow.rs | 3 - tests/ui/unsafe/unsafe-borrow.stderr | 27 + tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr | 27 - tests/ui/unsafe/unsafe-const-fn.mir.stderr | 11 - tests/ui/unsafe/unsafe-const-fn.rs | 3 - tests/ui/unsafe/unsafe-const-fn.stderr | 11 + tests/ui/unsafe/unsafe-const-fn.thir.stderr | 11 - .../unsafe/unsafe-fn-assign-deref-ptr.mir.stderr | 11 - tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs | 3 - tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr | 11 + .../unsafe/unsafe-fn-assign-deref-ptr.thir.stderr | 11 - .../unsafe/unsafe-fn-called-from-safe.mir.stderr | 11 - tests/ui/unsafe/unsafe-fn-called-from-safe.rs | 6 +- tests/ui/unsafe/unsafe-fn-called-from-safe.stderr | 11 + .../unsafe/unsafe-fn-called-from-safe.thir.stderr | 11 - tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr | 35 - tests/ui/unsafe/unsafe-fn-deref-ptr.rs | 3 - tests/ui/unsafe/unsafe-fn-deref-ptr.stderr | 35 + tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr | 35 - tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr | 11 - tests/ui/unsafe/unsafe-fn-used-as-value.rs | 6 +- tests/ui/unsafe/unsafe-fn-used-as-value.stderr | 11 + .../ui/unsafe/unsafe-fn-used-as-value.thir.stderr | 11 - .../unsafe/unsafe-not-inherited.mirunsafeck.stderr | 24 - tests/ui/unsafe/unsafe-not-inherited.rs | 2 - tests/ui/unsafe/unsafe-not-inherited.stderr | 24 + .../unsafe-not-inherited.thirunsafeck.stderr | 24 - .../ui/unsafe/unsafe-unstable-const-fn.mir.stderr | 11 - tests/ui/unsafe/unsafe-unstable-const-fn.rs | 3 - tests/ui/unsafe/unsafe-unstable-const-fn.stderr | 11 + .../ui/unsafe/unsafe-unstable-const-fn.thir.stderr | 11 - tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed | 67 + .../ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed | 73 - .../unsafe/wrapping-unsafe-block-sugg.mir.stderr | 99 -- tests/ui/unsafe/wrapping-unsafe-block-sugg.rs | 18 +- tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr | 99 ++ .../unsafe/wrapping-unsafe-block-sugg.thir.fixed | 73 - .../unsafe/wrapping-unsafe-block-sugg.thir.stderr | 99 -- 339 files changed, 4019 insertions(+), 7992 deletions(-) delete mode 100644 tests/ui/asm/bad-arch.mirunsafeck.stderr create mode 100644 tests/ui/asm/bad-arch.stderr delete mode 100644 tests/ui/asm/bad-arch.thirunsafeck.stderr create mode 100644 tests/ui/asm/bad-template.aarch64.stderr delete mode 100644 tests/ui/asm/bad-template.aarch64_mirunsafeck.stderr delete mode 100644 tests/ui/asm/bad-template.aarch64_thirunsafeck.stderr create mode 100644 tests/ui/asm/bad-template.x86_64.stderr delete mode 100644 tests/ui/asm/bad-template.x86_64_mirunsafeck.stderr delete mode 100644 tests/ui/asm/bad-template.x86_64_thirunsafeck.stderr delete mode 100644 tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr create mode 100644 tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr delete mode 100644 tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr delete mode 100644 tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr create mode 100644 tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr delete mode 100644 tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr delete mode 100644 tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr create mode 100644 tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr delete mode 100644 tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr create mode 100644 tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr delete mode 100644 tests/ui/consts/issue-16538.mir.stderr create mode 100644 tests/ui/consts/issue-16538.stderr delete mode 100644 tests/ui/consts/issue-16538.thir.stderr delete mode 100644 tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr create mode 100644 tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr delete mode 100644 tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr delete mode 100644 tests/ui/error-codes/E0133.mir.stderr create mode 100644 tests/ui/error-codes/E0133.stderr delete mode 100644 tests/ui/error-codes/E0133.thir.stderr delete mode 100644 tests/ui/extern/issue-28324.mir.stderr create mode 100644 tests/ui/extern/issue-28324.stderr delete mode 100644 tests/ui/extern/issue-28324.thir.stderr delete mode 100644 tests/ui/inline-const/expr-unsafe-err.mir.stderr create mode 100644 tests/ui/inline-const/expr-unsafe-err.stderr delete mode 100644 tests/ui/inline-const/expr-unsafe-err.thir.stderr delete mode 100644 tests/ui/inline-const/expr-unsafe.mir.stderr create mode 100644 tests/ui/inline-const/expr-unsafe.stderr delete mode 100644 tests/ui/inline-const/expr-unsafe.thir.stderr delete mode 100644 tests/ui/inline-const/pat-unsafe-err.thir.stderr delete mode 100644 tests/ui/inline-const/pat-unsafe.thir.stderr delete mode 100644 tests/ui/intrinsics/issue-28575.mir.stderr create mode 100644 tests/ui/intrinsics/issue-28575.stderr delete mode 100644 tests/ui/intrinsics/issue-28575.thir.stderr delete mode 100644 tests/ui/intrinsics/unchecked_math_unsafe.mir.stderr create mode 100644 tests/ui/intrinsics/unchecked_math_unsafe.stderr delete mode 100644 tests/ui/intrinsics/unchecked_math_unsafe.thir.stderr delete mode 100644 tests/ui/issues/issue-28776.mir.stderr create mode 100644 tests/ui/issues/issue-28776.stderr delete mode 100644 tests/ui/issues/issue-28776.thir.stderr delete mode 100644 tests/ui/issues/issue-48131.mir.stderr create mode 100644 tests/ui/issues/issue-48131.stderr delete mode 100644 tests/ui/issues/issue-48131.thir.stderr delete mode 100644 tests/ui/issues/issue-5844.mir.stderr create mode 100644 tests/ui/issues/issue-5844.stderr delete mode 100644 tests/ui/issues/issue-5844.thir.stderr delete mode 100644 tests/ui/pattern/non-structural-match-types.mir.stderr create mode 100644 tests/ui/pattern/non-structural-match-types.stderr delete mode 100644 tests/ui/pattern/non-structural-match-types.thir.stderr create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr create mode 100644 tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr delete mode 100644 tests/ui/span/lint-unused-unsafe.mir.stderr create mode 100644 tests/ui/span/lint-unused-unsafe.stderr delete mode 100644 tests/ui/span/lint-unused-unsafe.thir.stderr delete mode 100644 tests/ui/static/safe-extern-statics-mut.mir.stderr create mode 100644 tests/ui/static/safe-extern-statics-mut.stderr delete mode 100644 tests/ui/static/safe-extern-statics-mut.thir.stderr delete mode 100644 tests/ui/static/safe-extern-statics.mir.stderr create mode 100644 tests/ui/static/safe-extern-statics.stderr delete mode 100644 tests/ui/static/safe-extern-statics.thir.stderr delete mode 100644 tests/ui/static/static-mut-foreign-requires-unsafe.mir.stderr create mode 100644 tests/ui/static/static-mut-foreign-requires-unsafe.stderr delete mode 100644 tests/ui/static/static-mut-foreign-requires-unsafe.thir.stderr delete mode 100644 tests/ui/static/static-mut-requires-unsafe.mir.stderr create mode 100644 tests/ui/static/static-mut-requires-unsafe.stderr delete mode 100644 tests/ui/static/static-mut-requires-unsafe.thir.stderr delete mode 100644 tests/ui/statics/issue-14227.mir.stderr create mode 100644 tests/ui/statics/issue-14227.stderr delete mode 100644 tests/ui/statics/issue-14227.thir.stderr delete mode 100644 tests/ui/thread-local/thread-local-static.mir.stderr create mode 100644 tests/ui/thread-local/thread-local-static.stderr delete mode 100644 tests/ui/thread-local/thread-local-static.thir.stderr delete mode 100644 tests/ui/threads-sendsync/issue-43733.mir.stderr create mode 100644 tests/ui/threads-sendsync/issue-43733.stderr delete mode 100644 tests/ui/threads-sendsync/issue-43733.thir.stderr delete mode 100644 tests/ui/traits/safety-fn-body.mir.stderr create mode 100644 tests/ui/traits/safety-fn-body.stderr delete mode 100644 tests/ui/traits/safety-fn-body.thir.stderr delete mode 100644 tests/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr create mode 100644 tests/ui/union/union-borrow-move-parent-sibling.stderr delete mode 100644 tests/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-deref.mirunsafeck.stderr create mode 100644 tests/ui/union/union-deref.stderr delete mode 100644 tests/ui/union/union-deref.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-derive-clone.mirunsafeck.stderr create mode 100644 tests/ui/union/union-derive-clone.stderr delete mode 100644 tests/ui/union/union-derive-clone.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-derive-eq.mirunsafeck.stderr create mode 100644 tests/ui/union/union-derive-eq.stderr delete mode 100644 tests/ui/union/union-derive-eq.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-fields-1.mirunsafeck.stderr create mode 100644 tests/ui/union/union-fields-1.stderr delete mode 100644 tests/ui/union/union-fields-1.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-fields-2.mirunsafeck.stderr create mode 100644 tests/ui/union/union-fields-2.stderr delete mode 100644 tests/ui/union/union-fields-2.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-generic.mirunsafeck.stderr create mode 100644 tests/ui/union/union-generic.stderr delete mode 100644 tests/ui/union/union-generic.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-lint-dead-code.mirunsafeck.stderr create mode 100644 tests/ui/union/union-lint-dead-code.stderr delete mode 100644 tests/ui/union/union-lint-dead-code.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-move.mirunsafeck.stderr create mode 100644 tests/ui/union/union-move.stderr delete mode 100644 tests/ui/union/union-move.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-suggest-field.mirunsafeck.stderr create mode 100644 tests/ui/union/union-suggest-field.stderr delete mode 100644 tests/ui/union/union-suggest-field.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-unsafe.mir.stderr create mode 100644 tests/ui/union/union-unsafe.stderr delete mode 100644 tests/ui/union/union-unsafe.thir.stderr delete mode 100644 tests/ui/union/union-unsized.mirunsafeck.stderr create mode 100644 tests/ui/union/union-unsized.stderr delete mode 100644 tests/ui/union/union-unsized.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-with-drop-fields.mirunsafeck.stderr create mode 100644 tests/ui/union/union-with-drop-fields.stderr delete mode 100644 tests/ui/union/union-with-drop-fields.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/access_union_field.mir.stderr create mode 100644 tests/ui/unsafe/access_union_field.stderr delete mode 100644 tests/ui/unsafe/access_union_field.thir.stderr delete mode 100644 tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr create mode 100644 tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr delete mode 100644 tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr delete mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr create mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.stderr delete mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr delete mode 100644 tests/ui/unsafe/inline_asm.mir.stderr create mode 100644 tests/ui/unsafe/inline_asm.stderr delete mode 100644 tests/ui/unsafe/inline_asm.thir.stderr delete mode 100644 tests/ui/unsafe/issue-3080.mir.stderr create mode 100644 tests/ui/unsafe/issue-3080.stderr delete mode 100644 tests/ui/unsafe/issue-3080.thir.stderr delete mode 100644 tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr create mode 100644 tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr delete mode 100644 tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr delete mode 100644 tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.stderr create mode 100644 tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr delete mode 100644 tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr delete mode 100644 tests/ui/unsafe/issue-47412.mir.stderr create mode 100644 tests/ui/unsafe/issue-47412.stderr delete mode 100644 tests/ui/unsafe/issue-47412.thir.stderr delete mode 100644 tests/ui/unsafe/ranged_ints.mir.stderr create mode 100644 tests/ui/unsafe/ranged_ints.stderr delete mode 100644 tests/ui/unsafe/ranged_ints.thir.stderr delete mode 100644 tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints2.stderr delete mode 100644 tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints2_const.stderr delete mode 100644 tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints3.stderr delete mode 100644 tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints3_const.stderr delete mode 100644 tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints3_match.stderr delete mode 100644 tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints4.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints4.stderr delete mode 100644 tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/ranged_ints4_const.stderr delete mode 100644 tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints_const.mir.stderr create mode 100644 tests/ui/unsafe/ranged_ints_const.stderr delete mode 100644 tests/ui/unsafe/ranged_ints_const.thir.stderr delete mode 100644 tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr create mode 100644 tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr delete mode 100644 tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr delete mode 100644 tests/ui/unsafe/union-assignop.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/union-assignop.stderr delete mode 100644 tests/ui/unsafe/union-assignop.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/union.mir.stderr create mode 100644 tests/ui/unsafe/union.stderr delete mode 100644 tests/ui/unsafe/union.thir.stderr delete mode 100644 tests/ui/unsafe/union_destructure.mir.stderr create mode 100644 tests/ui/unsafe/union_destructure.stderr delete mode 100644 tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr delete mode 100644 tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr delete mode 100644 tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/unsafe-assign.stderr delete mode 100644 tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/unsafe-borrow.stderr delete mode 100644 tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/unsafe-const-fn.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-const-fn.stderr delete mode 100644 tests/ui/unsafe/unsafe-const-fn.thir.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-fn-called-from-safe.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-fn-deref-ptr.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-fn-used-as-value.stderr delete mode 100644 tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr delete mode 100644 tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr create mode 100644 tests/ui/unsafe/unsafe-not-inherited.stderr delete mode 100644 tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr create mode 100644 tests/ui/unsafe/unsafe-unstable-const-fn.stderr delete mode 100644 tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr create mode 100644 tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed delete mode 100644 tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed delete mode 100644 tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr create mode 100644 tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr delete mode 100644 tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed delete mode 100644 tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr diff --git a/tests/ui/asm/aarch64/const.rs b/tests/ui/asm/aarch64/const.rs index de299bfdbdf..0b02c99abf6 100644 --- a/tests/ui/asm/aarch64/const.rs +++ b/tests/ui/asm/aarch64/const.rs @@ -1,8 +1,6 @@ // only-aarch64 // run-pass // needs-asm-support -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![feature(asm_const)] diff --git a/tests/ui/asm/bad-arch.mirunsafeck.stderr b/tests/ui/asm/bad-arch.mirunsafeck.stderr deleted file mode 100644 index d7af296152f..00000000000 --- a/tests/ui/asm/bad-arch.mirunsafeck.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:22:9 - | -LL | asm!(""); - | ^^^^^^^^ - -error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:27:1 - | -LL | global_asm!(""); - | ^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0472`. diff --git a/tests/ui/asm/bad-arch.rs b/tests/ui/asm/bad-arch.rs index 93309899bf3..3eeb76f3d00 100644 --- a/tests/ui/asm/bad-arch.rs +++ b/tests/ui/asm/bad-arch.rs @@ -1,7 +1,5 @@ // compile-flags: --target sparc-unknown-linux-gnu // needs-llvm-components: sparc -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![feature(no_core, lang_items, rustc_attrs)] #![no_core] diff --git a/tests/ui/asm/bad-arch.stderr b/tests/ui/asm/bad-arch.stderr new file mode 100644 index 00000000000..23aad9908ef --- /dev/null +++ b/tests/ui/asm/bad-arch.stderr @@ -0,0 +1,17 @@ +error[E0472]: inline assembly is unsupported on this target + --> $DIR/bad-arch.rs:20:9 + | +LL | asm!(""); + | ^^^^^^^^ + +error[E0472]: inline assembly is unsupported on this target + --> $DIR/bad-arch.rs:25:1 + | +LL | global_asm!(""); + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0472`. diff --git a/tests/ui/asm/bad-arch.thirunsafeck.stderr b/tests/ui/asm/bad-arch.thirunsafeck.stderr deleted file mode 100644 index d7af296152f..00000000000 --- a/tests/ui/asm/bad-arch.thirunsafeck.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:22:9 - | -LL | asm!(""); - | ^^^^^^^^ - -error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:27:1 - | -LL | global_asm!(""); - | ^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0472`. diff --git a/tests/ui/asm/bad-template.aarch64.stderr b/tests/ui/asm/bad-template.aarch64.stderr new file mode 100644 index 00000000000..4ffcd2303b7 --- /dev/null +++ b/tests/ui/asm/bad-template.aarch64.stderr @@ -0,0 +1,202 @@ +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:27:15 + | +LL | asm!("{}"); + | ^^ from here + | + = note: no arguments were given + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:29:15 + | +LL | asm!("{1}", in(reg) foo); + | ^^^ from here + | + = note: there is 1 argument + +error: argument never used + --> $DIR/bad-template.rs:29:21 + | +LL | asm!("{1}", in(reg) foo); + | ^^^^^^^^^^^ argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` + +error: there is no argument named `a` + --> $DIR/bad-template.rs:32:16 + | +LL | asm!("{a}"); + | ^ + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:34:15 + | +LL | asm!("{}", a = in(reg) foo); + | ^^ --------------- named argument + | | + | from here + | + = note: no positional arguments were given +note: named arguments cannot be referenced by position + --> $DIR/bad-template.rs:34:20 + | +LL | asm!("{}", a = in(reg) foo); + | ^^^^^^^^^^^^^^^ + +error: named argument never used + --> $DIR/bad-template.rs:34:20 + | +LL | asm!("{}", a = in(reg) foo); + | ^^^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:37:15 + | +LL | asm!("{1}", a = in(reg) foo); + | ^^^ from here + | + = note: no positional arguments were given + +error: named argument never used + --> $DIR/bad-template.rs:37:21 + | +LL | asm!("{1}", a = in(reg) foo); + | ^^^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:44:15 + | +LL | asm!("{}", in("x0") foo); + | ^^ ------------ explicit register argument + | | + | from here + | + = note: no positional arguments were given +note: explicit register arguments cannot be used in the asm template + --> $DIR/bad-template.rs:44:20 + | +LL | asm!("{}", in("x0") foo); + | ^^^^^^^^^^^^ +help: use the register name directly in the assembly code + --> $DIR/bad-template.rs:44:20 + | +LL | asm!("{}", in("x0") foo); + | ^^^^^^^^^^^^ + +error: asm template modifier must be a single character + --> $DIR/bad-template.rs:46:17 + | +LL | asm!("{:foo}", in(reg) foo); + | ^^^ + +error: multiple unused asm arguments + --> $DIR/bad-template.rs:49:18 + | +LL | asm!("", in(reg) 0, in(reg) 1); + | ^^^^^^^^^ ^^^^^^^^^ argument never used + | | + | argument never used + | + = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:55:14 + | +LL | global_asm!("{}"); + | ^^ from here + | + = note: no arguments were given + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:57:14 + | +LL | global_asm!("{1}", const FOO); + | ^^^ from here + | + = note: there is 1 argument + +error: argument never used + --> $DIR/bad-template.rs:57:20 + | +LL | global_asm!("{1}", const FOO); + | ^^^^^^^^^ argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` + +error: there is no argument named `a` + --> $DIR/bad-template.rs:60:15 + | +LL | global_asm!("{a}"); + | ^ + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:62:14 + | +LL | global_asm!("{}", a = const FOO); + | ^^ ------------- named argument + | | + | from here + | + = note: no positional arguments were given +note: named arguments cannot be referenced by position + --> $DIR/bad-template.rs:62:19 + | +LL | global_asm!("{}", a = const FOO); + | ^^^^^^^^^^^^^ + +error: named argument never used + --> $DIR/bad-template.rs:62:19 + | +LL | global_asm!("{}", a = const FOO); + | ^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:65:14 + | +LL | global_asm!("{1}", a = const FOO); + | ^^^ from here + | + = note: no positional arguments were given + +error: named argument never used + --> $DIR/bad-template.rs:65:20 + | +LL | global_asm!("{1}", a = const FOO); + | ^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: asm template modifier must be a single character + --> $DIR/bad-template.rs:68:16 + | +LL | global_asm!("{:foo}", const FOO); + | ^^^ + +error: multiple unused asm arguments + --> $DIR/bad-template.rs:70:17 + | +LL | global_asm!("", const FOO, const FOO); + | ^^^^^^^^^ ^^^^^^^^^ argument never used + | | + | argument never used + | + = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` + +warning: formatting may not be suitable for sub-register argument + --> $DIR/bad-template.rs:46:15 + | +LL | asm!("{:foo}", in(reg) foo); + | ^^^^^^ --- for this argument + | + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` + = note: `#[warn(asm_sub_register)]` on by default + +error: aborting due to 21 previous errors; 1 warning emitted + diff --git a/tests/ui/asm/bad-template.aarch64_mirunsafeck.stderr b/tests/ui/asm/bad-template.aarch64_mirunsafeck.stderr deleted file mode 100644 index b16f9a06c2a..00000000000 --- a/tests/ui/asm/bad-template.aarch64_mirunsafeck.stderr +++ /dev/null @@ -1,202 +0,0 @@ -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:31:15 - | -LL | asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:33:15 - | -LL | asm!("{1}", in(reg) foo); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:33:21 - | -LL | asm!("{1}", in(reg) foo); - | ^^^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:36:16 - | -LL | asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:38:15 - | -LL | asm!("{}", a = in(reg) foo); - | ^^ --------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:41:15 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:41:21 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:48:15 - | -LL | asm!("{}", in("x0") foo); - | ^^ ------------ explicit register argument - | | - | from here - | - = note: no positional arguments were given -note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:48:20 - | -LL | asm!("{}", in("x0") foo); - | ^^^^^^^^^^^^ -help: use the register name directly in the assembly code - --> $DIR/bad-template.rs:48:20 - | -LL | asm!("{}", in("x0") foo); - | ^^^^^^^^^^^^ - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:50:17 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:53:18 - | -LL | asm!("", in(reg) 0, in(reg) 1); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:59:14 - | -LL | global_asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:61:14 - | -LL | global_asm!("{1}", const FOO); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:61:20 - | -LL | global_asm!("{1}", const FOO); - | ^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:64:15 - | -LL | global_asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:66:14 - | -LL | global_asm!("{}", a = const FOO); - | ^^ ------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:69:14 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:69:20 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:72:16 - | -LL | global_asm!("{:foo}", const FOO); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:74:17 - | -LL | global_asm!("", const FOO, const FOO); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/bad-template.rs:50:15 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^^^^ --- for this argument - | - = help: use `{0:w}` to have the register formatted as `w0` - = help: or use `{0:x}` to keep the default formatting of `x0` - = note: `#[warn(asm_sub_register)]` on by default - -error: aborting due to 21 previous errors; 1 warning emitted - diff --git a/tests/ui/asm/bad-template.aarch64_thirunsafeck.stderr b/tests/ui/asm/bad-template.aarch64_thirunsafeck.stderr deleted file mode 100644 index b16f9a06c2a..00000000000 --- a/tests/ui/asm/bad-template.aarch64_thirunsafeck.stderr +++ /dev/null @@ -1,202 +0,0 @@ -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:31:15 - | -LL | asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:33:15 - | -LL | asm!("{1}", in(reg) foo); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:33:21 - | -LL | asm!("{1}", in(reg) foo); - | ^^^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:36:16 - | -LL | asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:38:15 - | -LL | asm!("{}", a = in(reg) foo); - | ^^ --------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:41:15 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:41:21 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:48:15 - | -LL | asm!("{}", in("x0") foo); - | ^^ ------------ explicit register argument - | | - | from here - | - = note: no positional arguments were given -note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:48:20 - | -LL | asm!("{}", in("x0") foo); - | ^^^^^^^^^^^^ -help: use the register name directly in the assembly code - --> $DIR/bad-template.rs:48:20 - | -LL | asm!("{}", in("x0") foo); - | ^^^^^^^^^^^^ - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:50:17 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:53:18 - | -LL | asm!("", in(reg) 0, in(reg) 1); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:59:14 - | -LL | global_asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:61:14 - | -LL | global_asm!("{1}", const FOO); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:61:20 - | -LL | global_asm!("{1}", const FOO); - | ^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:64:15 - | -LL | global_asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:66:14 - | -LL | global_asm!("{}", a = const FOO); - | ^^ ------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:69:14 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:69:20 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:72:16 - | -LL | global_asm!("{:foo}", const FOO); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:74:17 - | -LL | global_asm!("", const FOO, const FOO); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/bad-template.rs:50:15 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^^^^ --- for this argument - | - = help: use `{0:w}` to have the register formatted as `w0` - = help: or use `{0:x}` to keep the default formatting of `x0` - = note: `#[warn(asm_sub_register)]` on by default - -error: aborting due to 21 previous errors; 1 warning emitted - diff --git a/tests/ui/asm/bad-template.rs b/tests/ui/asm/bad-template.rs index 55637174792..a6a233a36ec 100644 --- a/tests/ui/asm/bad-template.rs +++ b/tests/ui/asm/bad-template.rs @@ -1,14 +1,10 @@ -// revisions: x86_64_mirunsafeck aarch64_mirunsafeck x86_64_thirunsafeck aarch64_thirunsafeck +// revisions: x86_64 aarch64 -// [x86_64_thirunsafeck] compile-flags: -Z thir-unsafeck --target x86_64-unknown-linux-gnu -// [aarch64_thirunsafeck] compile-flags: -Z thir-unsafeck --target aarch64-unknown-linux-gnu -// [x86_64_mirunsafeck] compile-flags: --target x86_64-unknown-linux-gnu -// [aarch64_mirunsafeck] compile-flags: --target aarch64-unknown-linux-gnu +// [x86_64] compile-flags: --target x86_64-unknown-linux-gnu +// [aarch64] compile-flags: --target aarch64-unknown-linux-gnu -// [x86_64_thirunsafeck] needs-llvm-components: x86 -// [x86_64_mirunsafeck] needs-llvm-components: x86 -// [aarch64_thirunsafeck] needs-llvm-components: aarch64 -// [aarch64_mirunsafeck] needs-llvm-components: aarch64 +// [x86_64] needs-llvm-components: x86 +// [aarch64] needs-llvm-components: aarch64 #![feature(no_core, lang_items, rustc_attrs, asm_const)] #![no_core] @@ -41,12 +37,12 @@ fn main() { asm!("{1}", a = in(reg) foo); //~^ ERROR invalid reference to argument at index 1 //~^^ ERROR named argument never used - #[cfg(any(x86_64_thirunsafeck, x86_64_mirunsafeck))] + #[cfg(any(x86_64))] asm!("{}", in("eax") foo); - //[x86_64_thirunsafeck,x86_64_mirunsafeck]~^ ERROR invalid reference to argument at index 0 - #[cfg(any(aarch64_thirunsafeck, aarch64_mirunsafeck))] + //[x86_64]~^ ERROR invalid reference to argument at index 0 + #[cfg(any(aarch64))] asm!("{}", in("x0") foo); - //[aarch64_thirunsafeck,aarch64_mirunsafeck]~^ ERROR invalid reference to argument at index 0 + //[aarch64]~^ ERROR invalid reference to argument at index 0 asm!("{:foo}", in(reg) foo); //~^ ERROR asm template modifier must be a single character //~| WARN formatting may not be suitable for sub-register argument [asm_sub_register] diff --git a/tests/ui/asm/bad-template.x86_64.stderr b/tests/ui/asm/bad-template.x86_64.stderr new file mode 100644 index 00000000000..52a7789b98c --- /dev/null +++ b/tests/ui/asm/bad-template.x86_64.stderr @@ -0,0 +1,202 @@ +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:27:15 + | +LL | asm!("{}"); + | ^^ from here + | + = note: no arguments were given + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:29:15 + | +LL | asm!("{1}", in(reg) foo); + | ^^^ from here + | + = note: there is 1 argument + +error: argument never used + --> $DIR/bad-template.rs:29:21 + | +LL | asm!("{1}", in(reg) foo); + | ^^^^^^^^^^^ argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` + +error: there is no argument named `a` + --> $DIR/bad-template.rs:32:16 + | +LL | asm!("{a}"); + | ^ + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:34:15 + | +LL | asm!("{}", a = in(reg) foo); + | ^^ --------------- named argument + | | + | from here + | + = note: no positional arguments were given +note: named arguments cannot be referenced by position + --> $DIR/bad-template.rs:34:20 + | +LL | asm!("{}", a = in(reg) foo); + | ^^^^^^^^^^^^^^^ + +error: named argument never used + --> $DIR/bad-template.rs:34:20 + | +LL | asm!("{}", a = in(reg) foo); + | ^^^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:37:15 + | +LL | asm!("{1}", a = in(reg) foo); + | ^^^ from here + | + = note: no positional arguments were given + +error: named argument never used + --> $DIR/bad-template.rs:37:21 + | +LL | asm!("{1}", a = in(reg) foo); + | ^^^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:41:15 + | +LL | asm!("{}", in("eax") foo); + | ^^ ------------- explicit register argument + | | + | from here + | + = note: no positional arguments were given +note: explicit register arguments cannot be used in the asm template + --> $DIR/bad-template.rs:41:20 + | +LL | asm!("{}", in("eax") foo); + | ^^^^^^^^^^^^^ +help: use the register name directly in the assembly code + --> $DIR/bad-template.rs:41:20 + | +LL | asm!("{}", in("eax") foo); + | ^^^^^^^^^^^^^ + +error: asm template modifier must be a single character + --> $DIR/bad-template.rs:46:17 + | +LL | asm!("{:foo}", in(reg) foo); + | ^^^ + +error: multiple unused asm arguments + --> $DIR/bad-template.rs:49:18 + | +LL | asm!("", in(reg) 0, in(reg) 1); + | ^^^^^^^^^ ^^^^^^^^^ argument never used + | | + | argument never used + | + = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:55:14 + | +LL | global_asm!("{}"); + | ^^ from here + | + = note: no arguments were given + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:57:14 + | +LL | global_asm!("{1}", const FOO); + | ^^^ from here + | + = note: there is 1 argument + +error: argument never used + --> $DIR/bad-template.rs:57:20 + | +LL | global_asm!("{1}", const FOO); + | ^^^^^^^^^ argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` + +error: there is no argument named `a` + --> $DIR/bad-template.rs:60:15 + | +LL | global_asm!("{a}"); + | ^ + +error: invalid reference to argument at index 0 + --> $DIR/bad-template.rs:62:14 + | +LL | global_asm!("{}", a = const FOO); + | ^^ ------------- named argument + | | + | from here + | + = note: no positional arguments were given +note: named arguments cannot be referenced by position + --> $DIR/bad-template.rs:62:19 + | +LL | global_asm!("{}", a = const FOO); + | ^^^^^^^^^^^^^ + +error: named argument never used + --> $DIR/bad-template.rs:62:19 + | +LL | global_asm!("{}", a = const FOO); + | ^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: invalid reference to argument at index 1 + --> $DIR/bad-template.rs:65:14 + | +LL | global_asm!("{1}", a = const FOO); + | ^^^ from here + | + = note: no positional arguments were given + +error: named argument never used + --> $DIR/bad-template.rs:65:20 + | +LL | global_asm!("{1}", a = const FOO); + | ^^^^^^^^^^^^^ named argument never used + | + = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` + +error: asm template modifier must be a single character + --> $DIR/bad-template.rs:68:16 + | +LL | global_asm!("{:foo}", const FOO); + | ^^^ + +error: multiple unused asm arguments + --> $DIR/bad-template.rs:70:17 + | +LL | global_asm!("", const FOO, const FOO); + | ^^^^^^^^^ ^^^^^^^^^ argument never used + | | + | argument never used + | + = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` + +warning: formatting may not be suitable for sub-register argument + --> $DIR/bad-template.rs:46:15 + | +LL | asm!("{:foo}", in(reg) foo); + | ^^^^^^ --- for this argument + | + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` + = note: `#[warn(asm_sub_register)]` on by default + +error: aborting due to 21 previous errors; 1 warning emitted + diff --git a/tests/ui/asm/bad-template.x86_64_mirunsafeck.stderr b/tests/ui/asm/bad-template.x86_64_mirunsafeck.stderr deleted file mode 100644 index 41ac37c33c2..00000000000 --- a/tests/ui/asm/bad-template.x86_64_mirunsafeck.stderr +++ /dev/null @@ -1,202 +0,0 @@ -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:31:15 - | -LL | asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:33:15 - | -LL | asm!("{1}", in(reg) foo); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:33:21 - | -LL | asm!("{1}", in(reg) foo); - | ^^^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:36:16 - | -LL | asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:38:15 - | -LL | asm!("{}", a = in(reg) foo); - | ^^ --------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:41:15 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:41:21 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:45:15 - | -LL | asm!("{}", in("eax") foo); - | ^^ ------------- explicit register argument - | | - | from here - | - = note: no positional arguments were given -note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:45:20 - | -LL | asm!("{}", in("eax") foo); - | ^^^^^^^^^^^^^ -help: use the register name directly in the assembly code - --> $DIR/bad-template.rs:45:20 - | -LL | asm!("{}", in("eax") foo); - | ^^^^^^^^^^^^^ - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:50:17 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:53:18 - | -LL | asm!("", in(reg) 0, in(reg) 1); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:59:14 - | -LL | global_asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:61:14 - | -LL | global_asm!("{1}", const FOO); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:61:20 - | -LL | global_asm!("{1}", const FOO); - | ^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:64:15 - | -LL | global_asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:66:14 - | -LL | global_asm!("{}", a = const FOO); - | ^^ ------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:69:14 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:69:20 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:72:16 - | -LL | global_asm!("{:foo}", const FOO); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:74:17 - | -LL | global_asm!("", const FOO, const FOO); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/bad-template.rs:50:15 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^^^^ --- for this argument - | - = help: use `{0:e}` to have the register formatted as `eax` - = help: or use `{0:r}` to keep the default formatting of `rax` - = note: `#[warn(asm_sub_register)]` on by default - -error: aborting due to 21 previous errors; 1 warning emitted - diff --git a/tests/ui/asm/bad-template.x86_64_thirunsafeck.stderr b/tests/ui/asm/bad-template.x86_64_thirunsafeck.stderr deleted file mode 100644 index 41ac37c33c2..00000000000 --- a/tests/ui/asm/bad-template.x86_64_thirunsafeck.stderr +++ /dev/null @@ -1,202 +0,0 @@ -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:31:15 - | -LL | asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:33:15 - | -LL | asm!("{1}", in(reg) foo); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:33:21 - | -LL | asm!("{1}", in(reg) foo); - | ^^^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:36:16 - | -LL | asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:38:15 - | -LL | asm!("{}", a = in(reg) foo); - | ^^ --------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:38:20 - | -LL | asm!("{}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:41:15 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:41:21 - | -LL | asm!("{1}", a = in(reg) foo); - | ^^^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:45:15 - | -LL | asm!("{}", in("eax") foo); - | ^^ ------------- explicit register argument - | | - | from here - | - = note: no positional arguments were given -note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:45:20 - | -LL | asm!("{}", in("eax") foo); - | ^^^^^^^^^^^^^ -help: use the register name directly in the assembly code - --> $DIR/bad-template.rs:45:20 - | -LL | asm!("{}", in("eax") foo); - | ^^^^^^^^^^^^^ - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:50:17 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:53:18 - | -LL | asm!("", in(reg) 0, in(reg) 1); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:59:14 - | -LL | global_asm!("{}"); - | ^^ from here - | - = note: no arguments were given - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:61:14 - | -LL | global_asm!("{1}", const FOO); - | ^^^ from here - | - = note: there is 1 argument - -error: argument never used - --> $DIR/bad-template.rs:61:20 - | -LL | global_asm!("{1}", const FOO); - | ^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` - -error: there is no argument named `a` - --> $DIR/bad-template.rs:64:15 - | -LL | global_asm!("{a}"); - | ^ - -error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:66:14 - | -LL | global_asm!("{}", a = const FOO); - | ^^ ------------- named argument - | | - | from here - | - = note: no positional arguments were given -note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ - -error: named argument never used - --> $DIR/bad-template.rs:66:19 - | -LL | global_asm!("{}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:69:14 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^ from here - | - = note: no positional arguments were given - -error: named argument never used - --> $DIR/bad-template.rs:69:20 - | -LL | global_asm!("{1}", a = const FOO); - | ^^^^^^^^^^^^^ named argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` - -error: asm template modifier must be a single character - --> $DIR/bad-template.rs:72:16 - | -LL | global_asm!("{:foo}", const FOO); - | ^^^ - -error: multiple unused asm arguments - --> $DIR/bad-template.rs:74:17 - | -LL | global_asm!("", const FOO, const FOO); - | ^^^^^^^^^ ^^^^^^^^^ argument never used - | | - | argument never used - | - = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/bad-template.rs:50:15 - | -LL | asm!("{:foo}", in(reg) foo); - | ^^^^^^ --- for this argument - | - = help: use `{0:e}` to have the register formatted as `eax` - = help: or use `{0:r}` to keep the default formatting of `rax` - = note: `#[warn(asm_sub_register)]` on by default - -error: aborting due to 21 previous errors; 1 warning emitted - diff --git a/tests/ui/asm/x86_64/const.rs b/tests/ui/asm/x86_64/const.rs index d523ae021a5..f9a2ab6269f 100644 --- a/tests/ui/asm/x86_64/const.rs +++ b/tests/ui/asm/x86_64/const.rs @@ -1,8 +1,6 @@ // only-x86_64 // run-pass // needs-asm-support -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![feature(asm_const)] diff --git a/tests/ui/async-await/async-await.rs b/tests/ui/async-await/async-await.rs index 9cabf16f8bb..63941a79139 100644 --- a/tests/ui/async-await/async-await.rs +++ b/tests/ui/async-await/async-await.rs @@ -1,8 +1,7 @@ // run-pass -// revisions: default nomiropt thirunsafeck +// revisions: default nomiropt //[nomiropt]compile-flags: -Z mir-opt-level=0 -//[thirunsafeck]compile-flags: -Zthir-unsafeck #![allow(unused)] diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr deleted file mode 100644 index f9e5bf675cb..00000000000 --- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs index 14cc0dc614f..f7e9e96bff7 100644 --- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs +++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs @@ -1,6 +1,4 @@ // edition:2018 -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck struct S; @@ -12,18 +10,14 @@ async unsafe fn f() {} async fn g() { S::f(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `S::f` is unsafe + //~^ ERROR call to unsafe function is unsafe 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 } fn main() { S::f(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `S::f` is unsafe + //~^ ERROR call to unsafe function is unsafe 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/async-await/async-unsafe-fn-call-in-safe.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr new file mode 100644 index 00000000000..89c496c598d --- /dev/null +++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr @@ -0,0 +1,35 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:12:5 + | +LL | S::f(); + | ^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 + | +LL | f(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 + | +LL | S::f(); + | ^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/async-unsafe-fn-call-in-safe.rs:21:5 + | +LL | f(); + | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr deleted file mode 100644 index ba3303fe793..00000000000 --- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr deleted file mode 100644 index 2f9c7973b5a..00000000000 --- a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 - | -LL | let result: i32 = foo(5, 5); - | ^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 - | -LL | let result: i32 = foo(5, 5); - | ^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs index bdb3eb23c38..76a0f291410 100644 --- a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs +++ b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - // Ensure we get unsafe function after coercion unsafe fn add(a: i32, b: i32) -> i32 { a + b diff --git a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr new file mode 100644 index 00000000000..190b4792ebc --- /dev/null +++ b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:12:23 + | +LL | let result: i32 = foo(5, 5); + | ^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:21:23 + | +LL | let result: i32 = foo(5, 5); + | ^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr deleted file mode 100644 index 2f9c7973b5a..00000000000 --- a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 - | -LL | let result: i32 = foo(5, 5); - | ^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 - | -LL | let result: i32 = foo(5, 5); - | ^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr deleted file mode 100644 index 57922770310..00000000000 --- a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31 - | -LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs index 57358fbdd84..36777693fab 100644 --- a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs +++ b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - fn main() { let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; //~^ ERROR E0133 diff --git a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr new file mode 100644 index 00000000000..75c379c88e3 --- /dev/null +++ b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31 + | +LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr deleted file mode 100644 index fb237231d65..00000000000 --- a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `Pin::

::new_unchecked` is unsafe and requires unsafe function or block - --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31 - | -LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/closures/thir-unsafeck-issue-85871.rs b/tests/ui/closures/thir-unsafeck-issue-85871.rs index aea539b74df..a4a487c4dc2 100644 --- a/tests/ui/closures/thir-unsafeck-issue-85871.rs +++ b/tests/ui/closures/thir-unsafeck-issue-85871.rs @@ -1,6 +1,5 @@ // Tests that no ICE occurs when a closure appears inside a node // that does not have a body when compiling with -// compile-flags: -Zthir-unsafeck=yes // check-pass #![allow(dead_code)] diff --git a/tests/ui/command/command-pre-exec.rs b/tests/ui/command/command-pre-exec.rs index d366c5ffbfd..e8a909eecc1 100644 --- a/tests/ui/command/command-pre-exec.rs +++ b/tests/ui/command/command-pre-exec.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![allow(stable_features)] // ignore-windows - this is a unix-specific test diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs index 6c4f0a5accf..896d4b376fd 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -1,15 +1,10 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(const_extern_fn)] const unsafe extern "C" fn foo() -> usize { 5 } fn main() { let a: [u8; foo()]; - //[mir]~^ call to unsafe function is unsafe and requires unsafe function or block - //[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block + //~^ call to unsafe function is unsafe and requires unsafe function or block foo(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block - //[thir]~^^ ERROR call to unsafe function `foo` 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/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr new file mode 100644 index 00000000000..5196b8ee0a2 --- /dev/null +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/const-extern-fn-requires-unsafe.rs:8:5 + | +LL | foo(); + | ^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/const-extern-fn-requires-unsafe.rs:6:17 + | +LL | let a: [u8; foo()]; + | ^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/consts/issue-16538.mir.stderr b/tests/ui/consts/issue-16538.mir.stderr deleted file mode 100644 index e320df4b7ad..00000000000 --- a/tests/ui/consts/issue-16538.mir.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0015]: cannot call non-const fn `Y::foo` in statics - --> $DIR/issue-16538.rs:14:23 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:30 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:21 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const 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: aborting due to 3 previous errors - -Some errors have detailed explanations: E0015, E0133. -For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-16538.rs b/tests/ui/consts/issue-16538.rs index 270fa301414..31f334fb405 100644 --- a/tests/ui/consts/issue-16538.rs +++ b/tests/ui/consts/issue-16538.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - mod Y { pub type X = usize; extern "C" { diff --git a/tests/ui/consts/issue-16538.stderr b/tests/ui/consts/issue-16538.stderr new file mode 100644 index 00000000000..afb344f5e85 --- /dev/null +++ b/tests/ui/consts/issue-16538.stderr @@ -0,0 +1,29 @@ +error[E0015]: cannot call non-const fn `Y::foo` in statics + --> $DIR/issue-16538.rs:11:23 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:11:30 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:11:21 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const 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: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0133. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/issue-16538.thir.stderr b/tests/ui/consts/issue-16538.thir.stderr deleted file mode 100644 index 4a862869274..00000000000 --- a/tests/ui/consts/issue-16538.thir.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:22 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const 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[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:14:30 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0015]: cannot call non-const fn `Y::foo` in statics - --> $DIR/issue-16538.rs:14:23 - | -LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0015, E0133. -For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr deleted file mode 100644 index 11dc57bcf46..00000000000 --- a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9 - | -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: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs index 7961b58597c..dab9c81bc8f 100644 --- a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs +++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(coroutines)] fn main() { diff --git a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr new file mode 100644 index 00000000000..d0f200b8360 --- /dev/null +++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr @@ -0,0 +1,11 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-45729-unsafe-in-coroutine.rs:5:9 + | +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: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr deleted file mode 100644 index a61689a0df5..00000000000 --- a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9 - | -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: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/coroutine/static-mut-reference-across-yield.rs b/tests/ui/coroutine/static-mut-reference-across-yield.rs index 07f810856a7..0ed849e0e7d 100644 --- a/tests/ui/coroutine/static-mut-reference-across-yield.rs +++ b/tests/ui/coroutine/static-mut-reference-across-yield.rs @@ -1,6 +1,4 @@ // build-pass -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![feature(coroutines)] diff --git a/tests/ui/error-codes/E0133.mir.stderr b/tests/ui/error-codes/E0133.mir.stderr deleted file mode 100644 index f8703ef0633..00000000000 --- a/tests/ui/error-codes/E0133.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/E0133.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/error-codes/E0133.rs b/tests/ui/error-codes/E0133.rs index dee1475ba21..52494ce6078 100644 --- a/tests/ui/error-codes/E0133.rs +++ b/tests/ui/error-codes/E0133.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - unsafe fn f() { return; } fn main() { diff --git a/tests/ui/error-codes/E0133.stderr b/tests/ui/error-codes/E0133.stderr new file mode 100644 index 00000000000..a1ae6cb7fc9 --- /dev/null +++ b/tests/ui/error-codes/E0133.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/E0133.rs:4: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/error-codes/E0133.thir.stderr b/tests/ui/error-codes/E0133.thir.stderr deleted file mode 100644 index fd4d42bcb8b..00000000000 --- a/tests/ui/error-codes/E0133.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block - --> $DIR/E0133.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/extern/issue-28324.mir.stderr b/tests/ui/extern/issue-28324.mir.stderr deleted file mode 100644 index 9376ac35e21..00000000000 --- a/tests/ui/extern/issue-28324.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28324.rs:8:24 - | -LL | pub static BAZ: u32 = *&error_message_count; - | ^^^^^^^^^^^^^^^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/extern/issue-28324.rs b/tests/ui/extern/issue-28324.rs index fbe83e325ed..f74726e8166 100644 --- a/tests/ui/extern/issue-28324.rs +++ b/tests/ui/extern/issue-28324.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - extern "C" { static error_message_count: u32; } diff --git a/tests/ui/extern/issue-28324.stderr b/tests/ui/extern/issue-28324.stderr new file mode 100644 index 00000000000..be748b47d4d --- /dev/null +++ b/tests/ui/extern/issue-28324.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-28324.rs:5:24 + | +LL | pub static BAZ: u32 = *&error_message_count; + | ^^^^^^^^^^^^^^^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/extern/issue-28324.thir.stderr b/tests/ui/extern/issue-28324.thir.stderr deleted file mode 100644 index 8857f379ad1..00000000000 --- a/tests/ui/extern/issue-28324.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28324.rs:8:25 - | -LL | pub static BAZ: u32 = *&error_message_count; - | ^^^^^^^^^^^^^^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/inline-const/expr-unsafe-err.mir.stderr b/tests/ui/inline-const/expr-unsafe-err.mir.stderr deleted file mode 100644 index ebd18f89d9c..00000000000 --- a/tests/ui/inline-const/expr-unsafe-err.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/expr-unsafe-err.rs:8:9 - | -LL | require_unsafe(); - | ^^^^^^^^^^^^^^^^ 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/inline-const/expr-unsafe-err.rs b/tests/ui/inline-const/expr-unsafe-err.rs index adf05d352ea..a05a2945168 100644 --- a/tests/ui/inline-const/expr-unsafe-err.rs +++ b/tests/ui/inline-const/expr-unsafe-err.rs @@ -1,7 +1,7 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![feature(inline_const)] -const unsafe fn require_unsafe() -> usize { 1 } +const unsafe fn require_unsafe() -> usize { + 1 +} fn main() { const { diff --git a/tests/ui/inline-const/expr-unsafe-err.stderr b/tests/ui/inline-const/expr-unsafe-err.stderr new file mode 100644 index 00000000000..ebd18f89d9c --- /dev/null +++ b/tests/ui/inline-const/expr-unsafe-err.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/expr-unsafe-err.rs:8:9 + | +LL | require_unsafe(); + | ^^^^^^^^^^^^^^^^ 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/inline-const/expr-unsafe-err.thir.stderr b/tests/ui/inline-const/expr-unsafe-err.thir.stderr deleted file mode 100644 index 45f850d1f99..00000000000 --- a/tests/ui/inline-const/expr-unsafe-err.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block - --> $DIR/expr-unsafe-err.rs:8:9 - | -LL | require_unsafe(); - | ^^^^^^^^^^^^^^^^ 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/inline-const/expr-unsafe.mir.stderr b/tests/ui/inline-const/expr-unsafe.mir.stderr deleted file mode 100644 index 1ab6e42fba0..00000000000 --- a/tests/ui/inline-const/expr-unsafe.mir.stderr +++ /dev/null @@ -1,14 +0,0 @@ -warning: unnecessary `unsafe` block - --> $DIR/expr-unsafe.rs:12:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/expr-unsafe.rs:4:9 - | -LL | #![warn(unused_unsafe)] - | ^^^^^^^^^^^^^ - -warning: 1 warning emitted - diff --git a/tests/ui/inline-const/expr-unsafe.rs b/tests/ui/inline-const/expr-unsafe.rs index d71efd33db1..2370c58a712 100644 --- a/tests/ui/inline-const/expr-unsafe.rs +++ b/tests/ui/inline-const/expr-unsafe.rs @@ -1,6 +1,5 @@ // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck + #![warn(unused_unsafe)] #![feature(inline_const)] const unsafe fn require_unsafe() -> usize { 1 } diff --git a/tests/ui/inline-const/expr-unsafe.stderr b/tests/ui/inline-const/expr-unsafe.stderr new file mode 100644 index 00000000000..47334aaab83 --- /dev/null +++ b/tests/ui/inline-const/expr-unsafe.stderr @@ -0,0 +1,14 @@ +warning: unnecessary `unsafe` block + --> $DIR/expr-unsafe.rs:11:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/expr-unsafe.rs:3:9 + | +LL | #![warn(unused_unsafe)] + | ^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/inline-const/expr-unsafe.thir.stderr b/tests/ui/inline-const/expr-unsafe.thir.stderr deleted file mode 100644 index 1ab6e42fba0..00000000000 --- a/tests/ui/inline-const/expr-unsafe.thir.stderr +++ /dev/null @@ -1,14 +0,0 @@ -warning: unnecessary `unsafe` block - --> $DIR/expr-unsafe.rs:12:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/expr-unsafe.rs:4:9 - | -LL | #![warn(unused_unsafe)] - | ^^^^^^^^^^^^^ - -warning: 1 warning emitted - diff --git a/tests/ui/inline-const/pat-unsafe-err.rs b/tests/ui/inline-const/pat-unsafe-err.rs index 6df281c6d94..0db18dd3260 100644 --- a/tests/ui/inline-const/pat-unsafe-err.rs +++ b/tests/ui/inline-const/pat-unsafe-err.rs @@ -1,6 +1,4 @@ -// revisions: mir thir -// [mir]ignore-test This is currently broken -// [thir]compile-flags: -Z thir-unsafeck +// ignore-test This is currently broken #![allow(incomplete_features)] #![feature(inline_const_pat)] diff --git a/tests/ui/inline-const/pat-unsafe-err.thir.stderr b/tests/ui/inline-const/pat-unsafe-err.thir.stderr deleted file mode 100644 index 48a2cb4c704..00000000000 --- a/tests/ui/inline-const/pat-unsafe-err.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block - --> $DIR/pat-unsafe-err.rs:15:13 - | -LL | require_unsafe(); - | ^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block - --> $DIR/pat-unsafe-err.rs:22:13 - | -LL | require_unsafe() - | ^^^^^^^^^^^^^^^^ 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/inline-const/pat-unsafe.rs b/tests/ui/inline-const/pat-unsafe.rs index 36f8632af67..cfef9ad6a56 100644 --- a/tests/ui/inline-const/pat-unsafe.rs +++ b/tests/ui/inline-const/pat-unsafe.rs @@ -1,7 +1,5 @@ // check-pass -// revisions: mir thir -// [mir]ignore-test This is currently broken -// [thir]compile-flags: -Z thir-unsafeck +// ignore-test This is currently broken #![allow(incomplete_features)] #![warn(unused_unsafe)] diff --git a/tests/ui/inline-const/pat-unsafe.thir.stderr b/tests/ui/inline-const/pat-unsafe.thir.stderr deleted file mode 100644 index 0318b3ff2cc..00000000000 --- a/tests/ui/inline-const/pat-unsafe.thir.stderr +++ /dev/null @@ -1,20 +0,0 @@ -warning: unnecessary `unsafe` block - --> $DIR/pat-unsafe.rs:19:17 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/pat-unsafe.rs:7:9 - | -LL | #![warn(unused_unsafe)] - | ^^^^^^^^^^^^^ - -warning: unnecessary `unsafe` block - --> $DIR/pat-unsafe.rs:26:17 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -warning: 2 warnings emitted - diff --git a/tests/ui/intrinsics/issue-28575.mir.stderr b/tests/ui/intrinsics/issue-28575.mir.stderr deleted file mode 100644 index 4b29b4c1b6a..00000000000 --- a/tests/ui/intrinsics/issue-28575.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28575.rs:11:5 - | -LL | FOO() - | ^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/intrinsics/issue-28575.rs b/tests/ui/intrinsics/issue-28575.rs index 410f664f89d..141136d25b2 100644 --- a/tests/ui/intrinsics/issue-28575.rs +++ b/tests/ui/intrinsics/issue-28575.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(intrinsics)] extern "C" { diff --git a/tests/ui/intrinsics/issue-28575.stderr b/tests/ui/intrinsics/issue-28575.stderr new file mode 100644 index 00000000000..8a7816f231f --- /dev/null +++ b/tests/ui/intrinsics/issue-28575.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-28575.rs:8:5 + | +LL | FOO() + | ^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/intrinsics/issue-28575.thir.stderr b/tests/ui/intrinsics/issue-28575.thir.stderr deleted file mode 100644 index 4b29b4c1b6a..00000000000 --- a/tests/ui/intrinsics/issue-28575.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28575.rs:11:5 - | -LL | FOO() - | ^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/intrinsics/unchecked_math_unsafe.mir.stderr b/tests/ui/intrinsics/unchecked_math_unsafe.mir.stderr deleted file mode 100644 index 26b2f9f2713..00000000000 --- a/tests/ui/intrinsics/unchecked_math_unsafe.mir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:8:15 - | -LL | let add = std::intrinsics::unchecked_add(x, y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:9:15 - | -LL | let sub = std::intrinsics::unchecked_sub(x, y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:10:15 - | -LL | let mul = std::intrinsics::unchecked_mul(x, y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/unchecked_math_unsafe.rs b/tests/ui/intrinsics/unchecked_math_unsafe.rs index 98d3a11ad02..a034b45f530 100644 --- a/tests/ui/intrinsics/unchecked_math_unsafe.rs +++ b/tests/ui/intrinsics/unchecked_math_unsafe.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(core_intrinsics)] fn main() { diff --git a/tests/ui/intrinsics/unchecked_math_unsafe.stderr b/tests/ui/intrinsics/unchecked_math_unsafe.stderr new file mode 100644 index 00000000000..4066cf8efb8 --- /dev/null +++ b/tests/ui/intrinsics/unchecked_math_unsafe.stderr @@ -0,0 +1,27 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unchecked_math_unsafe.rs:5:15 + | +LL | let add = std::intrinsics::unchecked_add(x, y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unchecked_math_unsafe.rs:6:15 + | +LL | let sub = std::intrinsics::unchecked_sub(x, y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unchecked_math_unsafe.rs:7:15 + | +LL | let mul = std::intrinsics::unchecked_mul(x, y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/unchecked_math_unsafe.thir.stderr b/tests/ui/intrinsics/unchecked_math_unsafe.thir.stderr deleted file mode 100644 index 5c3728ccdf8..00000000000 --- a/tests/ui/intrinsics/unchecked_math_unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: call to unsafe function `unchecked_add` is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:8:15 - | -LL | let add = std::intrinsics::unchecked_add(x, y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `unchecked_sub` is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:9:15 - | -LL | let sub = std::intrinsics::unchecked_sub(x, y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `unchecked_mul` is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:10:15 - | -LL | let mul = std::intrinsics::unchecked_mul(x, y); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-11740.rs b/tests/ui/issues/issue-11740.rs index fa80f509b32..c3badfd9b49 100644 --- a/tests/ui/issues/issue-11740.rs +++ b/tests/ui/issues/issue-11740.rs @@ -1,6 +1,4 @@ // check-pass -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck struct Attr { name: String, diff --git a/tests/ui/issues/issue-28776.mir.stderr b/tests/ui/issues/issue-28776.mir.stderr deleted file mode 100644 index e7b7ba08268..00000000000 --- a/tests/ui/issues/issue-28776.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-28776.rs:7:5 - | -LL | (&ptr::write)(1 as *mut _, 42); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-28776.rs b/tests/ui/issues/issue-28776.rs index 19df3c4a425..e564ebcd110 100644 --- a/tests/ui/issues/issue-28776.rs +++ b/tests/ui/issues/issue-28776.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - use std::ptr; fn main() { diff --git a/tests/ui/issues/issue-28776.stderr b/tests/ui/issues/issue-28776.stderr new file mode 100644 index 00000000000..9f0f10335ab --- /dev/null +++ b/tests/ui/issues/issue-28776.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-28776.rs:4:5 + | +LL | (&ptr::write)(1 as *mut _, 42); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-28776.thir.stderr b/tests/ui/issues/issue-28776.thir.stderr deleted file mode 100644 index 63172b85424..00000000000 --- a/tests/ui/issues/issue-28776.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `std::ptr::write` is unsafe and requires unsafe function or block - --> $DIR/issue-28776.rs:7:5 - | -LL | (&ptr::write)(1 as *mut _, 42); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-39367.rs b/tests/ui/issues/issue-39367.rs index e7beb8a0392..039b47ae780 100644 --- a/tests/ui/issues/issue-39367.rs +++ b/tests/ui/issues/issue-39367.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck use std::ops::Deref; diff --git a/tests/ui/issues/issue-48131.mir.stderr b/tests/ui/issues/issue-48131.mir.stderr deleted file mode 100644 index 6817e8830c5..00000000000 --- a/tests/ui/issues/issue-48131.mir.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:12:9 - | -LL | unsafe { /* unnecessary */ } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/issue-48131.rs:6:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:23:13 - | -LL | unsafe { /* unnecessary */ } - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-48131.rs b/tests/ui/issues/issue-48131.rs index df98547084d..85664e62ead 100644 --- a/tests/ui/issues/issue-48131.rs +++ b/tests/ui/issues/issue-48131.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - // This note is annotated because the purpose of the test // is to ensure that certain other notes are not generated. #![deny(unused_unsafe)] //~ NOTE diff --git a/tests/ui/issues/issue-48131.stderr b/tests/ui/issues/issue-48131.stderr new file mode 100644 index 00000000000..5acc4f16e9f --- /dev/null +++ b/tests/ui/issues/issue-48131.stderr @@ -0,0 +1,20 @@ +error: unnecessary `unsafe` block + --> $DIR/issue-48131.rs:9:9 + | +LL | unsafe { /* unnecessary */ } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/issue-48131.rs:3:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/issue-48131.rs:20:13 + | +LL | unsafe { /* unnecessary */ } + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-48131.thir.stderr b/tests/ui/issues/issue-48131.thir.stderr deleted file mode 100644 index 6817e8830c5..00000000000 --- a/tests/ui/issues/issue-48131.thir.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:12:9 - | -LL | unsafe { /* unnecessary */ } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/issue-48131.rs:6:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:23:13 - | -LL | unsafe { /* unnecessary */ } - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-5844.mir.stderr b/tests/ui/issues/issue-5844.mir.stderr deleted file mode 100644 index 4434f5a0ff2..00000000000 --- a/tests/ui/issues/issue-5844.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:8:5 - | -LL | issue_5844_aux::rand(); - | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-5844.rs b/tests/ui/issues/issue-5844.rs index 4f90a9c6645..0db1ccf76d9 100644 --- a/tests/ui/issues/issue-5844.rs +++ b/tests/ui/issues/issue-5844.rs @@ -1,9 +1,7 @@ //aux-build:issue-5844-aux.rs -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck extern crate issue_5844_aux; -fn main () { +fn main() { issue_5844_aux::rand(); //~ ERROR: requires unsafe } diff --git a/tests/ui/issues/issue-5844.stderr b/tests/ui/issues/issue-5844.stderr new file mode 100644 index 00000000000..af7bfb03320 --- /dev/null +++ b/tests/ui/issues/issue-5844.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-5844.rs:6:5 + | +LL | issue_5844_aux::rand(); + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-5844.thir.stderr b/tests/ui/issues/issue-5844.thir.stderr deleted file mode 100644 index 6074f7d0ed4..00000000000 --- a/tests/ui/issues/issue-5844.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:8:5 - | -LL | issue_5844_aux::rand(); - | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/lto/lto-still-runs-thread-dtors.rs b/tests/ui/lto/lto-still-runs-thread-dtors.rs index 1c7368b36e1..635ad783b31 100644 --- a/tests/ui/lto/lto-still-runs-thread-dtors.rs +++ b/tests/ui/lto/lto-still-runs-thread-dtors.rs @@ -2,8 +2,6 @@ // compile-flags: -C lto // no-prefer-dynamic // ignore-emscripten no threads support -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck use std::thread; diff --git a/tests/ui/pattern/non-structural-match-types.mir.stderr b/tests/ui/pattern/non-structural-match-types.mir.stderr deleted file mode 100644 index 7a9e5b7e02e..00000000000 --- a/tests/ui/pattern/non-structural-match-types.mir.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns - --> $DIR/non-structural-match-types.rs:12:9 - | -LL | const { || {} } => {} - | ^^^^^^^^^^^^^^^ - -error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns - --> $DIR/non-structural-match-types.rs:15:9 - | -LL | const { async {} } => {} - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/pattern/non-structural-match-types.rs b/tests/ui/pattern/non-structural-match-types.rs index fb7779fa808..b4f19bb8294 100644 --- a/tests/ui/pattern/non-structural-match-types.rs +++ b/tests/ui/pattern/non-structural-match-types.rs @@ -1,6 +1,4 @@ // edition:2021 -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![allow(incomplete_features)] #![allow(unreachable_code)] diff --git a/tests/ui/pattern/non-structural-match-types.stderr b/tests/ui/pattern/non-structural-match-types.stderr new file mode 100644 index 00000000000..4a6990da56f --- /dev/null +++ b/tests/ui/pattern/non-structural-match-types.stderr @@ -0,0 +1,14 @@ +error: `{closure@$DIR/non-structural-match-types.rs:10:17: 10:19}` cannot be used in patterns + --> $DIR/non-structural-match-types.rs:10:9 + | +LL | const { || {} } => {} + | ^^^^^^^^^^^^^^^ + +error: `{async block@$DIR/non-structural-match-types.rs:13:17: 13:25}` cannot be used in patterns + --> $DIR/non-structural-match-types.rs:13:9 + | +LL | const { async {} } => {} + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/pattern/non-structural-match-types.thir.stderr b/tests/ui/pattern/non-structural-match-types.thir.stderr deleted file mode 100644 index 7a9e5b7e02e..00000000000 --- a/tests/ui/pattern/non-structural-match-types.thir.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns - --> $DIR/non-structural-match-types.rs:12:9 - | -LL | const { || {} } => {} - | ^^^^^^^^^^^^^^^ - -error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns - --> $DIR/non-structural-match-types.rs:15:9 - | -LL | const { async {} } => {} - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/process/no-stdio.rs b/tests/ui/process/no-stdio.rs index 24985386a97..68e6fa838b4 100644 --- a/tests/ui/process/no-stdio.rs +++ b/tests/ui/process/no-stdio.rs @@ -2,8 +2,6 @@ // ignore-android // ignore-emscripten no processes // ignore-sgx no processes -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![feature(rustc_private)] diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs index e0842bfa4cd..58a2c271ecf 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs @@ -8,8 +8,6 @@ // check-pass // only-x86_64 -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![feature(target_feature_11)] diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs index a59d7c2d784..fefe100ba0e 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs @@ -1,18 +1,16 @@ // Tests #73631: closures inherit `#[target_feature]` annotations // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // only-x86_64 #![feature(target_feature_11)] -#[target_feature(enable="avx")] +#[target_feature(enable = "avx")] fn also_use_avx() { println!("Hello from AVX") } -#[target_feature(enable="avx")] +#[target_feature(enable = "avx")] fn use_avx() -> Box { Box::new(|| also_use_avx()) } diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs index c95d4a08e48..3ecea5c5313 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs @@ -1,5 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // only-x86_64 #![feature(target_feature_11)] diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr new file mode 100644 index 00000000000..cc941be5479 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/fn-ptr.rs:9:21 + | +LL | #[target_feature(enable = "sse2")] + | ---------------------------------- `#[target_feature]` added here +... +LL | let foo: fn() = foo; + | ---- ^^^ cannot coerce functions with `#[target_feature]` to safe function pointers + | | + | expected due to this + | + = note: expected fn pointer `fn()` + found fn item `fn() {foo}` + = note: fn items are distinct from fn pointers + = note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers +help: consider casting to a fn pointer + | +LL | let foo: fn() = foo as fn(); + | ~~~~~~~~~~~ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs index bc886400099..115f00b3f4e 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs @@ -1,8 +1,6 @@ // Tests #108655: closures in `#[target_feature]` functions can still be marked #[inline(always)] // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // only-x86_64 #![feature(target_feature_11)] diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs index f17dab269bc..b420d14d1e1 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs @@ -1,5 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // only-x86_64 #![feature(target_feature_11)] @@ -11,7 +9,6 @@ const fn sse2() {} #[target_feature(enable = "fxsr")] const fn sse2_and_fxsr() {} - #[target_feature(enable = "avx")] #[target_feature(enable = "bmi2")] fn avx_bmi2() {} @@ -26,62 +23,50 @@ impl Quux { fn foo() { sse2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe avx_bmi2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe Quux.avx_bmi2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe } #[target_feature(enable = "sse2")] fn bar() { avx_bmi2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe Quux.avx_bmi2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe } #[target_feature(enable = "avx")] fn baz() { sse2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe avx_bmi2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe Quux.avx_bmi2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe } #[target_feature(enable = "avx")] #[target_feature(enable = "bmi2")] fn qux() { sse2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe } const _: () = sse2(); -//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe -//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe +//~^ ERROR call to function with `#[target_feature]` is unsafe const _: () = sse2_and_fxsr(); -//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe -//[thir]~^^ ERROR call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe +//~^ ERROR call to function with `#[target_feature]` is unsafe #[deny(unsafe_op_in_unsafe_fn)] #[target_feature(enable = "avx")] #[target_feature(enable = "bmi2")] unsafe fn needs_unsafe_block() { sse2(); - //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe - //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe + //~^ ERROR call to function with `#[target_feature]` is unsafe } fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr new file mode 100644 index 00000000000..3897f09b576 --- /dev/null +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr @@ -0,0 +1,115 @@ +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:25:5 + | +LL | sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:27:5 + | +LL | avx_bmi2(); + | ^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:29:5 + | +LL | Quux.avx_bmi2(); + | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:35:5 + | +LL | avx_bmi2(); + | ^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:37:5 + | +LL | Quux.avx_bmi2(); + | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:43:5 + | +LL | sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:45:5 + | +LL | avx_bmi2(); + | ^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:47:5 + | +LL | Quux.avx_bmi2(); + | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:54:5 + | +LL | sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:58:15 + | +LL | const _: () = sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` + +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:61:15 + | +LL | const _: () = sse2_and_fxsr(); + | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr + = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` + +error: call to function with `#[target_feature]` is unsafe and requires unsafe block (error E0133) + --> $DIR/safe-calls.rs:68:5 + | +LL | sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` +note: an unsafe function restricts its caller, but its body is safe by default + --> $DIR/safe-calls.rs:67:1 + | +LL | unsafe fn needs_unsafe_block() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/safe-calls.rs:64:8 + | +LL | #[deny(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/runtime/running-with-no-runtime.rs b/tests/ui/runtime/running-with-no-runtime.rs index c575a6bec8e..c321e86dc18 100644 --- a/tests/ui/runtime/running-with-no-runtime.rs +++ b/tests/ui/runtime/running-with-no-runtime.rs @@ -1,8 +1,6 @@ // run-pass // ignore-emscripten spawning processes is not supported // ignore-sgx no processes -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![feature(start)] diff --git a/tests/ui/simd/intrinsic/generic-comparison-pass.rs b/tests/ui/simd/intrinsic/generic-comparison-pass.rs index da5c42a1a98..103132c18ae 100644 --- a/tests/ui/simd/intrinsic/generic-comparison-pass.rs +++ b/tests/ui/simd/intrinsic/generic-comparison-pass.rs @@ -1,7 +1,5 @@ // run-pass // ignore-emscripten FIXME(#45351) hits an LLVM assert -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![feature(repr_simd, platform_intrinsics, concat_idents)] #![allow(non_camel_case_types)] diff --git a/tests/ui/span/lint-unused-unsafe.mir.stderr b/tests/ui/span/lint-unused-unsafe.mir.stderr deleted file mode 100644 index 9e8d3359242..00000000000 --- a/tests/ui/span/lint-unused-unsafe.mir.stderr +++ /dev/null @@ -1,1402 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:22:13 - | -LL | fn bad1() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:10:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:23:13 - | -LL | fn bad2() { unsafe { bad1() } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:24:20 - | -LL | unsafe fn bad3() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:25:13 - | -LL | fn bad4() { unsafe { callback(||{}) } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:35:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:70:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:79:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:80:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:81:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:86:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:96:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:97:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:98:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:108:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:106:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:109:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:110:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:120:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:130:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:131:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:132:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:138:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:149:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:150:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:151:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:162:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:160:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:163:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:164:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:174:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:184:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:185:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:186:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:192:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:203:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:204:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:205:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:216:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:214:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:217:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:218:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:238:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:251:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:264:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:282:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:291:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:292:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:293:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:298:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:308:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:309:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:310:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:320:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:318:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:321:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:322:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:332:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:342:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:343:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:344:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:350:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:361:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:362:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:363:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:374:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:372:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:375:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:376:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:386:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:396:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:397:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:398:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:404:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:415:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:416:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:417:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:428:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:426:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:429:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:430:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:450:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:463:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:476:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:495:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:504:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:505:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:506:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:511:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:521:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:522:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:523:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:533:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:531:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:534:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:535:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:545:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:555:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:556:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:557:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:563:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:574:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:575:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:576:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:587:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:585:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:588:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:589:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:599:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:609:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:610:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:611:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:617:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:628:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:629:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:630:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:641:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:639:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:642:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:643:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:663:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:676:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:689:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:707:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:717:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:718:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:719:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:725:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:736:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:737:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:738:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:749:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:747:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:750:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:751:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:761:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:771:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:772:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:773:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:779:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:790:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:791:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:792:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:803:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:801:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:804:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:805:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:825:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:838:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:851:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:865:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:875:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:876:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:877:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:883:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:894:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:895:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:896:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:907:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:905:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:908:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:909:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:919:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:929:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:930:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:931:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:937:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:948:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:949:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:950:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:961:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:959:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:962:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:963:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:983:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:996:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1009:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1055:29 - | -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1062:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = async { unsf() }; -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1063:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1064:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1069:29 - | -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1076:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = async { unsf() }; -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1077:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1078:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1088:22 - | -LL | let _x: [(); unsafe { 0 }] = []; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1092:22 - | -LL | let _x: [(); unsafe { unsafe { size() } }] = []; - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 174 previous errors - diff --git a/tests/ui/span/lint-unused-unsafe.rs b/tests/ui/span/lint-unused-unsafe.rs index ca615f64f22..94bdd114007 100644 --- a/tests/ui/span/lint-unused-unsafe.rs +++ b/tests/ui/span/lint-unused-unsafe.rs @@ -3,9 +3,6 @@ // edition:2018 -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - #![allow(dead_code)] #![deny(unused_unsafe)] diff --git a/tests/ui/span/lint-unused-unsafe.stderr b/tests/ui/span/lint-unused-unsafe.stderr new file mode 100644 index 00000000000..d8bd7cc7475 --- /dev/null +++ b/tests/ui/span/lint-unused-unsafe.stderr @@ -0,0 +1,1402 @@ +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:19:13 + | +LL | fn bad1() { unsafe {} } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:7:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:20:13 + | +LL | fn bad2() { unsafe { bad1() } } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:21:20 + | +LL | unsafe fn bad3() { unsafe {} } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:22:13 + | +LL | fn bad4() { unsafe { callback(||{}) } } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:25:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:32:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:67:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:76:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:77:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:78:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:83:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:93:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:94:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:95:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:105:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:103:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:106:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:107:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:117:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:127:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:128:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:129:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:135:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:146:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:147:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:148:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:159:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:157:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:160:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:161:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:171:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:181:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:182:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:183:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:189:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:200:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:201:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:202:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:213:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:211:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:214:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:215:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:235:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:248:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:261:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:279:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:288:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:289:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:290:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:295:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:305:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:306:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:307:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:317:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:315:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:318:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:319:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:329:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:339:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:340:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:341:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:347:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:358:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:359:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:360:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:371:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:369:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:372:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:373:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:383:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:393:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:394:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:395:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:401:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:412:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:413:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:414:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:425:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:423:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:426:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:427:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:447:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:460:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:473:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:492:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:501:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:502:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:503:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:508:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:518:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:519:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:520:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:530:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:528:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:531:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:532:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:542:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:552:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:553:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:554:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:560:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:571:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:572:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:573:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:584:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:582:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:585:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:586:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:596:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:606:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:607:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:608:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:614:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:625:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:626:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:627:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:638:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:636:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:639:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:640:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:660:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:673:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:686:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:704:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:714:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:715:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:716:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:722:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:733:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:734:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:735:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:746:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:744:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:747:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:748:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:758:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:768:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:769:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:770:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:776:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:787:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:788:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:789:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:800:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:798:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:801:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:802:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:822:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:835:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:848:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:862:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:872:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:873:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:874:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:880:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:891:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:892:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:893:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:904:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:902:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:905:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:906:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:916:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:926:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:927:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:928:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:934:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:945:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:946:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:947:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:958:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:956:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:959:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:960:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:980:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:993:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1006:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1052:29 + | +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1059:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = async { unsf() }; +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1060:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1061:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1066:29 + | +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1073:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = async { unsf() }; +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1074:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1075:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1085:22 + | +LL | let _x: [(); unsafe { 0 }] = []; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1089:22 + | +LL | let _x: [(); unsafe { unsafe { size() } }] = []; + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 174 previous errors + diff --git a/tests/ui/span/lint-unused-unsafe.thir.stderr b/tests/ui/span/lint-unused-unsafe.thir.stderr deleted file mode 100644 index 9e8d3359242..00000000000 --- a/tests/ui/span/lint-unused-unsafe.thir.stderr +++ /dev/null @@ -1,1402 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:22:13 - | -LL | fn bad1() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:10:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:23:13 - | -LL | fn bad2() { unsafe { bad1() } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:24:20 - | -LL | unsafe fn bad3() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:25:13 - | -LL | fn bad4() { unsafe { callback(||{}) } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:35:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:70:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:79:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:80:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:81:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:86:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:96:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:97:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:98:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:108:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:106:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:109:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:110:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:120:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:130:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:131:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:132:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:138:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:149:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:150:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:151:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:162:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:160:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:163:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:164:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:174:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:184:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:185:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:186:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:192:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:203:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:204:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:205:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:216:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:214:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:217:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:218:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:238:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:251:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:264:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:282:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:291:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:292:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:293:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:298:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:308:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:309:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:310:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:320:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:318:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:321:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:322:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:332:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:342:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:343:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:344:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:350:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:361:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:362:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:363:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:374:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:372:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:375:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:376:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:386:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:396:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:397:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:398:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:404:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:415:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:416:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:417:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:428:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:426:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:429:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:430:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:450:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:463:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:476:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:495:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:504:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:505:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:506:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:511:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:521:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:522:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:523:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:533:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:531:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:534:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:535:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:545:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:555:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:556:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:557:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:563:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:574:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:575:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:576:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:587:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:585:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:588:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:589:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:599:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:609:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:610:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:611:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:617:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:628:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:629:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:630:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:641:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:639:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:642:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:643:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:663:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:676:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:689:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:707:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:717:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:718:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:719:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:725:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:736:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:737:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:738:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:749:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:747:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:750:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:751:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:761:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:771:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:772:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:773:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:779:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:790:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:791:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:792:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:803:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:801:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:804:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:805:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:825:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:838:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:851:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:865:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:875:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:876:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:877:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:883:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:894:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:895:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:896:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:907:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:905:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:908:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:909:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:919:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:929:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:930:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:931:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:937:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:948:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:949:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:950:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:961:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:959:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:962:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:963:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:983:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:996:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1009:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1055:29 - | -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1062:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = async { unsf() }; -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1063:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1064:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1069:29 - | -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1076:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = async { unsf() }; -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1077:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1078:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1088:22 - | -LL | let _x: [(); unsafe { 0 }] = []; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1092:22 - | -LL | let _x: [(); unsafe { unsafe { size() } }] = []; - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 174 previous errors - diff --git a/tests/ui/static/safe-extern-statics-mut.mir.stderr b/tests/ui/static/safe-extern-statics-mut.mir.stderr deleted file mode 100644 index cec5f9d9c9f..00000000000 --- a/tests/ui/static/safe-extern-statics-mut.mir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:13:13 - | -LL | let b = B; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:14:14 - | -LL | let rb = &B; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:15:14 - | -LL | let xb = XB; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:16:15 - | -LL | let xrb = &XB; - | ^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races 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/static/safe-extern-statics-mut.rs b/tests/ui/static/safe-extern-statics-mut.rs index 389a4589a71..324fa443aa5 100644 --- a/tests/ui/static/safe-extern-statics-mut.rs +++ b/tests/ui/static/safe-extern-statics-mut.rs @@ -1,6 +1,4 @@ // aux-build:extern-statics.rs -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck extern crate extern_statics; use extern_statics::*; diff --git a/tests/ui/static/safe-extern-statics-mut.stderr b/tests/ui/static/safe-extern-statics-mut.stderr new file mode 100644 index 00000000000..38803883414 --- /dev/null +++ b/tests/ui/static/safe-extern-statics-mut.stderr @@ -0,0 +1,35 @@ +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics-mut.rs:11:13 + | +LL | let b = B; + | ^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics-mut.rs:12:14 + | +LL | let rb = &B; + | ^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics-mut.rs:13:14 + | +LL | let xb = XB; + | ^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics-mut.rs:14:15 + | +LL | let xrb = &XB; + | ^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races 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/static/safe-extern-statics-mut.thir.stderr b/tests/ui/static/safe-extern-statics-mut.thir.stderr deleted file mode 100644 index 8e6d2805a0b..00000000000 --- a/tests/ui/static/safe-extern-statics-mut.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:13:13 - | -LL | let b = B; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:14:15 - | -LL | let rb = &B; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:15:14 - | -LL | let xb = XB; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:16:16 - | -LL | let xrb = &XB; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races 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/static/safe-extern-statics.mir.stderr b/tests/ui/static/safe-extern-statics.mir.stderr deleted file mode 100644 index 102abd0816f..00000000000 --- a/tests/ui/static/safe-extern-statics.mir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:13:13 - | -LL | let a = A; - | ^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:14:14 - | -LL | let ra = &A; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:15:14 - | -LL | let xa = XA; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:16:15 - | -LL | let xra = &XA; - | ^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races 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/static/safe-extern-statics.rs b/tests/ui/static/safe-extern-statics.rs index 0aa90c442ea..6fa4c4aaca5 100644 --- a/tests/ui/static/safe-extern-statics.rs +++ b/tests/ui/static/safe-extern-statics.rs @@ -1,6 +1,4 @@ // aux-build:extern-statics.rs -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck extern crate extern_statics; use extern_statics::*; diff --git a/tests/ui/static/safe-extern-statics.stderr b/tests/ui/static/safe-extern-statics.stderr new file mode 100644 index 00000000000..b42572ea3ee --- /dev/null +++ b/tests/ui/static/safe-extern-statics.stderr @@ -0,0 +1,35 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics.rs:11:13 + | +LL | let a = A; + | ^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics.rs:12:14 + | +LL | let ra = &A; + | ^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics.rs:13:14 + | +LL | let xa = XA; + | ^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/safe-extern-statics.rs:14:15 + | +LL | let xra = &XA; + | ^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races 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/static/safe-extern-statics.thir.stderr b/tests/ui/static/safe-extern-statics.thir.stderr deleted file mode 100644 index 7fd2182c4c6..00000000000 --- a/tests/ui/static/safe-extern-statics.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:13:13 - | -LL | let a = A; - | ^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:14:15 - | -LL | let ra = &A; - | ^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:15:14 - | -LL | let xa = XA; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:16:16 - | -LL | let xra = &XA; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races 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/static/static-mut-foreign-requires-unsafe.mir.stderr b/tests/ui/static/static-mut-foreign-requires-unsafe.mir.stderr deleted file mode 100644 index a4659bc8712..00000000000 --- a/tests/ui/static/static-mut-foreign-requires-unsafe.mir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:9:5 - | -LL | a += 3; - | ^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:10:5 - | -LL | a = 4; - | ^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:11:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/static/static-mut-foreign-requires-unsafe.rs b/tests/ui/static/static-mut-foreign-requires-unsafe.rs index 4f96acb3375..90aa2537a82 100644 --- a/tests/ui/static/static-mut-foreign-requires-unsafe.rs +++ b/tests/ui/static/static-mut-foreign-requires-unsafe.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - extern "C" { static mut a: i32; } diff --git a/tests/ui/static/static-mut-foreign-requires-unsafe.stderr b/tests/ui/static/static-mut-foreign-requires-unsafe.stderr new file mode 100644 index 00000000000..e7ed0b710b2 --- /dev/null +++ b/tests/ui/static/static-mut-foreign-requires-unsafe.stderr @@ -0,0 +1,27 @@ +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5 + | +LL | a += 3; + | ^^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5 + | +LL | a = 4; + | ^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/static-mut-foreign-requires-unsafe.rs:8:14 + | +LL | let _b = a; + | ^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/static/static-mut-foreign-requires-unsafe.thir.stderr b/tests/ui/static/static-mut-foreign-requires-unsafe.thir.stderr deleted file mode 100644 index 2c62d4d8f3b..00000000000 --- a/tests/ui/static/static-mut-foreign-requires-unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:9:5 - | -LL | a += 3; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:10:5 - | -LL | a = 4; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:11:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/static/static-mut-requires-unsafe.mir.stderr b/tests/ui/static/static-mut-requires-unsafe.mir.stderr deleted file mode 100644 index 0d4ce056fc2..00000000000 --- a/tests/ui/static/static-mut-requires-unsafe.mir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:7:5 - | -LL | a += 3; - | ^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:8:5 - | -LL | a = 4; - | ^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:9:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/static/static-mut-requires-unsafe.rs b/tests/ui/static/static-mut-requires-unsafe.rs index ea3ba095007..413b97e431d 100644 --- a/tests/ui/static/static-mut-requires-unsafe.rs +++ b/tests/ui/static/static-mut-requires-unsafe.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - static mut a: isize = 3; fn main() { diff --git a/tests/ui/static/static-mut-requires-unsafe.stderr b/tests/ui/static/static-mut-requires-unsafe.stderr new file mode 100644 index 00000000000..85e468b333c --- /dev/null +++ b/tests/ui/static/static-mut-requires-unsafe.stderr @@ -0,0 +1,27 @@ +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/static-mut-requires-unsafe.rs:4:5 + | +LL | a += 3; + | ^^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/static-mut-requires-unsafe.rs:5:5 + | +LL | a = 4; + | ^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/static-mut-requires-unsafe.rs:6:14 + | +LL | let _b = a; + | ^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/static/static-mut-requires-unsafe.thir.stderr b/tests/ui/static/static-mut-requires-unsafe.thir.stderr deleted file mode 100644 index 1a1cf14271a..00000000000 --- a/tests/ui/static/static-mut-requires-unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:7:5 - | -LL | a += 3; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:8:5 - | -LL | a = 4; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:9:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/statics/issue-14227.mir.stderr b/tests/ui/statics/issue-14227.mir.stderr deleted file mode 100644 index ab50b97d63f..00000000000 --- a/tests/ui/statics/issue-14227.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-14227.rs:7:21 - | -LL | static CRASH: u32 = symbol; - | ^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/statics/issue-14227.rs b/tests/ui/statics/issue-14227.rs index 5f866ec9061..a1fde14600a 100644 --- a/tests/ui/statics/issue-14227.rs +++ b/tests/ui/statics/issue-14227.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - extern "C" { pub static symbol: u32; } diff --git a/tests/ui/statics/issue-14227.stderr b/tests/ui/statics/issue-14227.stderr new file mode 100644 index 00000000000..085d6df9c41 --- /dev/null +++ b/tests/ui/statics/issue-14227.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-14227.rs:4:21 + | +LL | static CRASH: u32 = symbol; + | ^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/statics/issue-14227.thir.stderr b/tests/ui/statics/issue-14227.thir.stderr deleted file mode 100644 index ab50b97d63f..00000000000 --- a/tests/ui/statics/issue-14227.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-14227.rs:7:21 - | -LL | static CRASH: u32 = symbol; - | ^^^^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will 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/thread-local/thread-local-static.mir.stderr b/tests/ui/thread-local/thread-local-static.mir.stderr deleted file mode 100644 index 607d7ee902c..00000000000 --- a/tests/ui/thread-local/thread-local-static.mir.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:10:12 - | -LL | const fn g(x: &mut [u32; 8]) { - | ^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-static.rs:12:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - -error[E0013]: constant functions cannot refer to statics - --> $DIR/thread-local-static.rs:12:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - | - = help: consider extracting the value of the `static` to a `const`, and referring to that - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0013, E0133, E0625, E0658. -For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs index afaffbb7e9b..e6cd4839dda 100644 --- a/tests/ui/thread-local/thread-local-static.rs +++ b/tests/ui/thread-local/thread-local-static.rs @@ -1,6 +1,4 @@ // edition:2018 -// revisions: mir thir -//thir: -Zthir-unsafeck #![feature(thread_local)] #![feature(const_swap)] diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.stderr new file mode 100644 index 00000000000..f37fd9db36d --- /dev/null +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -0,0 +1,44 @@ +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/thread-local-static.rs:8:12 + | +LL | const fn g(x: &mut [u32; 8]) { + | ^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0625]: thread-local statics cannot be accessed at compile-time + --> $DIR/thread-local-static.rs:10:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ + +error[E0013]: constant functions cannot refer to statics + --> $DIR/thread-local-static.rs:10:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ + | + = help: consider extracting the value of the `static` to a `const`, and referring to that + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/thread-local-static.rs:10:23 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/thread-local-static.rs:10:23 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0013, E0133, E0625, E0658. +For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/thread-local/thread-local-static.thir.stderr b/tests/ui/thread-local/thread-local-static.thir.stderr deleted file mode 100644 index 607d7ee902c..00000000000 --- a/tests/ui/thread-local/thread-local-static.thir.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:10:12 - | -LL | const fn g(x: &mut [u32; 8]) { - | ^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-static.rs:12:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - -error[E0013]: constant functions cannot refer to statics - --> $DIR/thread-local-static.rs:12:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - | - = help: consider extracting the value of the `static` to a `const`, and referring to that - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #57349 for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0013, E0133, E0625, E0658. -For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/threads-sendsync/issue-43733.mir.stderr b/tests/ui/threads-sendsync/issue-43733.mir.stderr deleted file mode 100644 index ff83e16add9..00000000000 --- a/tests/ui/threads-sendsync/issue-43733.mir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:19:5 - | -LL | __KEY.get(Default::default) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:24:42 - | -LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/threads-sendsync/issue-43733.rs b/tests/ui/threads-sendsync/issue-43733.rs index cac745f1e12..996abb4809a 100644 --- a/tests/ui/threads-sendsync/issue-43733.rs +++ b/tests/ui/threads-sendsync/issue-43733.rs @@ -1,6 +1,4 @@ // ignore-wasm32 -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![feature(thread_local)] #![feature(cfg_target_thread_local, thread_local_internals)] @@ -17,13 +15,11 @@ static __KEY: std::thread::local_impl::Key = std::thread::local_impl::Key:: fn __getit(_: Option<&mut Option>>) -> std::option::Option<&'static Foo> { __KEY.get(Default::default) - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `Key::::get` + //~^ ERROR call to unsafe function is unsafe } static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); -//[mir]~^ ERROR call to unsafe function is unsafe -//[thir]~^^ ERROR call to unsafe function `LocalKey::::new` +//~^ ERROR call to unsafe function is unsafe fn main() { FOO.with(|foo| println!("{}", foo.borrow())); diff --git a/tests/ui/threads-sendsync/issue-43733.stderr b/tests/ui/threads-sendsync/issue-43733.stderr new file mode 100644 index 00000000000..9090fd0a4a6 --- /dev/null +++ b/tests/ui/threads-sendsync/issue-43733.stderr @@ -0,0 +1,19 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-43733.rs:17:5 + | +LL | __KEY.get(Default::default) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-43733.rs:21:42 + | +LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/threads-sendsync/issue-43733.thir.stderr b/tests/ui/threads-sendsync/issue-43733.thir.stderr deleted file mode 100644 index 94ec724044c..00000000000 --- a/tests/ui/threads-sendsync/issue-43733.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function `Key::::get` is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:19:5 - | -LL | __KEY.get(Default::default) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `LocalKey::::new` is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:24:42 - | -LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/traits/safety-fn-body.mir.stderr b/tests/ui/traits/safety-fn-body.mir.stderr deleted file mode 100644 index 9a04f3e7d62..00000000000 --- a/tests/ui/traits/safety-fn-body.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/safety-fn-body.rs:14:9 - | -LL | *self += 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/traits/safety-fn-body.rs b/tests/ui/traits/safety-fn-body.rs index 2cc4fe1b344..df527747305 100644 --- a/tests/ui/traits/safety-fn-body.rs +++ b/tests/ui/traits/safety-fn-body.rs @@ -1,9 +1,6 @@ // Check that an unsafe impl does not imply that unsafe actions are // legal in the methods. -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - unsafe trait UnsafeTrait : Sized { fn foo(self) { } } diff --git a/tests/ui/traits/safety-fn-body.stderr b/tests/ui/traits/safety-fn-body.stderr new file mode 100644 index 00000000000..284e73f572d --- /dev/null +++ b/tests/ui/traits/safety-fn-body.stderr @@ -0,0 +1,11 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/safety-fn-body.rs:11:9 + | +LL | *self += 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 1 previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/traits/safety-fn-body.thir.stderr b/tests/ui/traits/safety-fn-body.thir.stderr deleted file mode 100644 index 5d4626c161e..00000000000 --- a/tests/ui/traits/safety-fn-body.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/safety-fn-body.rs:14:9 - | -LL | *self += 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 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/union/union-align.rs b/tests/ui/union/union-align.rs index 6a44f27dbb2..67ab10fef4b 100644 --- a/tests/ui/union/union-align.rs +++ b/tests/ui/union/union-align.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] diff --git a/tests/ui/union/union-backcomp.rs b/tests/ui/union/union-backcomp.rs index b19eab9f52b..21b9fc50e1d 100644 --- a/tests/ui/union/union-backcomp.rs +++ b/tests/ui/union/union-backcomp.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(path_statements)] #![allow(dead_code)] diff --git a/tests/ui/union/union-basic.rs b/tests/ui/union/union-basic.rs index dcc552ac75c..1009def7d52 100644 --- a/tests/ui/union/union-basic.rs +++ b/tests/ui/union/union-basic.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(unused_imports)] diff --git a/tests/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr b/tests/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr deleted file mode 100644 index 7f931b49a58..00000000000 --- a/tests/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr +++ /dev/null @@ -1,84 +0,0 @@ -error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) - --> $DIR/union-borrow-move-parent-sibling.rs:56:13 - | -LL | let a = &mut (*u.x).0; - | --- mutable borrow occurs here (via `u.x`) -LL | let b = &u.y; - | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here -LL | use_borrow(a); - | - mutable borrow later used here - | - = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x` - -error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec, MockVec), MockVec)>` - --> $DIR/union-borrow-move-parent-sibling.rs:62:13 - | -LL | let a = u.x.0; - | ^^^^^ move occurs because value has type `(MockVec, MockVec)`, which does not implement the `Copy` trait - | -help: consider borrowing here - | -LL | let a = &u.x.0; - | + - -error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:64:13 - | -LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) }; - | - move occurs because `u` has type `U`, which does not implement the `Copy` trait -LL | let a = u.x.0; -LL | let a = u.x; - | --- value moved here -LL | let b = u.y; - | ^^^ value used here after move - -error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) - --> $DIR/union-borrow-move-parent-sibling.rs:70:13 - | -LL | let a = &mut ((*u.x).0).0; - | --- mutable borrow occurs here (via `u.x`) -LL | let b = &u.y; - | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here -LL | use_borrow(a); - | - mutable borrow later used here - | - = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x` - -error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec, MockVec), MockVec)>` - --> $DIR/union-borrow-move-parent-sibling.rs:76:13 - | -LL | let a = (u.x.0).0; - | ^^^^^^^^^ move occurs because value has type `MockVec`, which does not implement the `Copy` trait - | -help: consider borrowing here - | -LL | let a = &(u.x.0).0; - | + - -error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:78:13 - | -LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) }; - | - move occurs because `u` has type `U`, which does not implement the `Copy` trait -LL | let a = (u.x.0).0; -LL | let a = u.x; - | --- value moved here -LL | let b = u.y; - | ^^^ value used here after move - -error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`) - --> $DIR/union-borrow-move-parent-sibling.rs:84:13 - | -LL | let a = &mut *u.y; - | --- mutable borrow occurs here (via `u.y`) -LL | let b = &u.x; - | ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here -LL | use_borrow(a); - | - mutable borrow later used here - | - = note: `u.x` is a field of the union `U`, so it overlaps the field `u.y` - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0382, E0502, E0507. -For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/union/union-borrow-move-parent-sibling.rs b/tests/ui/union/union-borrow-move-parent-sibling.rs index 83781c5e550..5b0b44232e4 100644 --- a/tests/ui/union/union-borrow-move-parent-sibling.rs +++ b/tests/ui/union/union-borrow-move-parent-sibling.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![allow(unused)] use std::ops::{Deref, DerefMut}; diff --git a/tests/ui/union/union-borrow-move-parent-sibling.stderr b/tests/ui/union/union-borrow-move-parent-sibling.stderr new file mode 100644 index 00000000000..c9a440a66cc --- /dev/null +++ b/tests/ui/union/union-borrow-move-parent-sibling.stderr @@ -0,0 +1,84 @@ +error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) + --> $DIR/union-borrow-move-parent-sibling.rs:53:13 + | +LL | let a = &mut (*u.x).0; + | --- mutable borrow occurs here (via `u.x`) +LL | let b = &u.y; + | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here +LL | use_borrow(a); + | - mutable borrow later used here + | + = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x` + +error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec, MockVec), MockVec)>` + --> $DIR/union-borrow-move-parent-sibling.rs:59:13 + | +LL | let a = u.x.0; + | ^^^^^ move occurs because value has type `(MockVec, MockVec)`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let a = &u.x.0; + | + + +error[E0382]: use of moved value: `u` + --> $DIR/union-borrow-move-parent-sibling.rs:61:13 + | +LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) }; + | - move occurs because `u` has type `U`, which does not implement the `Copy` trait +LL | let a = u.x.0; +LL | let a = u.x; + | --- value moved here +LL | let b = u.y; + | ^^^ value used here after move + +error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) + --> $DIR/union-borrow-move-parent-sibling.rs:67:13 + | +LL | let a = &mut ((*u.x).0).0; + | --- mutable borrow occurs here (via `u.x`) +LL | let b = &u.y; + | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here +LL | use_borrow(a); + | - mutable borrow later used here + | + = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x` + +error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec, MockVec), MockVec)>` + --> $DIR/union-borrow-move-parent-sibling.rs:73:13 + | +LL | let a = (u.x.0).0; + | ^^^^^^^^^ move occurs because value has type `MockVec`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let a = &(u.x.0).0; + | + + +error[E0382]: use of moved value: `u` + --> $DIR/union-borrow-move-parent-sibling.rs:75:13 + | +LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) }; + | - move occurs because `u` has type `U`, which does not implement the `Copy` trait +LL | let a = (u.x.0).0; +LL | let a = u.x; + | --- value moved here +LL | let b = u.y; + | ^^^ value used here after move + +error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`) + --> $DIR/union-borrow-move-parent-sibling.rs:81:13 + | +LL | let a = &mut *u.y; + | --- mutable borrow occurs here (via `u.y`) +LL | let b = &u.x; + | ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here +LL | use_borrow(a); + | - mutable borrow later used here + | + = note: `u.x` is a field of the union `U`, so it overlaps the field `u.y` + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0382, E0502, E0507. +For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr b/tests/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr deleted file mode 100644 index 7f931b49a58..00000000000 --- a/tests/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr +++ /dev/null @@ -1,84 +0,0 @@ -error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) - --> $DIR/union-borrow-move-parent-sibling.rs:56:13 - | -LL | let a = &mut (*u.x).0; - | --- mutable borrow occurs here (via `u.x`) -LL | let b = &u.y; - | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here -LL | use_borrow(a); - | - mutable borrow later used here - | - = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x` - -error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec, MockVec), MockVec)>` - --> $DIR/union-borrow-move-parent-sibling.rs:62:13 - | -LL | let a = u.x.0; - | ^^^^^ move occurs because value has type `(MockVec, MockVec)`, which does not implement the `Copy` trait - | -help: consider borrowing here - | -LL | let a = &u.x.0; - | + - -error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:64:13 - | -LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) }; - | - move occurs because `u` has type `U`, which does not implement the `Copy` trait -LL | let a = u.x.0; -LL | let a = u.x; - | --- value moved here -LL | let b = u.y; - | ^^^ value used here after move - -error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) - --> $DIR/union-borrow-move-parent-sibling.rs:70:13 - | -LL | let a = &mut ((*u.x).0).0; - | --- mutable borrow occurs here (via `u.x`) -LL | let b = &u.y; - | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x` -- occurs here -LL | use_borrow(a); - | - mutable borrow later used here - | - = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x` - -error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec, MockVec), MockVec)>` - --> $DIR/union-borrow-move-parent-sibling.rs:76:13 - | -LL | let a = (u.x.0).0; - | ^^^^^^^^^ move occurs because value has type `MockVec`, which does not implement the `Copy` trait - | -help: consider borrowing here - | -LL | let a = &(u.x.0).0; - | + - -error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:78:13 - | -LL | let u = U { x: ManuallyDrop::new(((MockVec::new(), MockVec::new()), MockVec::new())) }; - | - move occurs because `u` has type `U`, which does not implement the `Copy` trait -LL | let a = (u.x.0).0; -LL | let a = u.x; - | --- value moved here -LL | let b = u.y; - | ^^^ value used here after move - -error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`) - --> $DIR/union-borrow-move-parent-sibling.rs:84:13 - | -LL | let a = &mut *u.y; - | --- mutable borrow occurs here (via `u.y`) -LL | let b = &u.x; - | ^^^^ immutable borrow of `u.x` -- which overlaps with `u.y` -- occurs here -LL | use_borrow(a); - | - mutable borrow later used here - | - = note: `u.x` is a field of the union `U`, so it overlaps the field `u.y` - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0382, E0502, E0507. -For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/union/union-const-codegen.rs b/tests/ui/union/union-const-codegen.rs index 32a546cf35f..d5b30559595 100644 --- a/tests/ui/union/union-const-codegen.rs +++ b/tests/ui/union/union-const-codegen.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck union U { a: u64, diff --git a/tests/ui/union/union-const-eval-field.rs b/tests/ui/union/union-const-eval-field.rs index ca48785cd9f..15a20899a78 100644 --- a/tests/ui/union/union-const-eval-field.rs +++ b/tests/ui/union/union-const-eval-field.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck type Field1 = (i32, u32); type Field2 = f32; diff --git a/tests/ui/union/union-const-eval.rs b/tests/ui/union/union-const-eval.rs index 32ee4a739ea..70a97795b75 100644 --- a/tests/ui/union/union-const-eval.rs +++ b/tests/ui/union/union-const-eval.rs @@ -1,6 +1,4 @@ // check-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck union U { a: usize, diff --git a/tests/ui/union/union-deref.mirunsafeck.stderr b/tests/ui/union/union-deref.mirunsafeck.stderr deleted file mode 100644 index be5e60ab88a..00000000000 --- a/tests/ui/union/union-deref.mirunsafeck.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:16:14 - | -LL | unsafe { u.f.0 = Vec::new() }; - | ^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:18:19 - | -LL | unsafe { &mut u.f.0 }; - | ^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:20:14 - | -LL | unsafe { u.f.0.push(0) }; - | ^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:24:14 - | -LL | unsafe { u.f.0.0 = Vec::new() }; - | ^^^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:26:19 - | -LL | unsafe { &mut u.f.0.0 }; - | ^^^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:28:14 - | -LL | unsafe { u.f.0.0.push(0) }; - | ^^^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: aborting due to 6 previous errors - diff --git a/tests/ui/union/union-deref.rs b/tests/ui/union/union-deref.rs index 5aa28d93f96..02f9bf2c413 100644 --- a/tests/ui/union/union-deref.rs +++ b/tests/ui/union/union-deref.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - //! Test the part of RFC 2514 that is about not applying `DerefMut` coercions //! of union fields. diff --git a/tests/ui/union/union-deref.stderr b/tests/ui/union/union-deref.stderr new file mode 100644 index 00000000000..38fce568ae7 --- /dev/null +++ b/tests/ui/union/union-deref.stderr @@ -0,0 +1,56 @@ +error: not automatically applying `DerefMut` on `ManuallyDrop` union field + --> $DIR/union-deref.rs:13:14 + | +LL | unsafe { u.f.0 = Vec::new() }; + | ^^^ + | + = help: writing to this reference calls the destructor for the old value + = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor + +error: not automatically applying `DerefMut` on `ManuallyDrop` union field + --> $DIR/union-deref.rs:15:19 + | +LL | unsafe { &mut u.f.0 }; + | ^^^ + | + = help: writing to this reference calls the destructor for the old value + = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor + +error: not automatically applying `DerefMut` on `ManuallyDrop` union field + --> $DIR/union-deref.rs:17:14 + | +LL | unsafe { u.f.0.push(0) }; + | ^^^ + | + = help: writing to this reference calls the destructor for the old value + = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor + +error: not automatically applying `DerefMut` on `ManuallyDrop` union field + --> $DIR/union-deref.rs:21:14 + | +LL | unsafe { u.f.0.0 = Vec::new() }; + | ^^^^^ + | + = help: writing to this reference calls the destructor for the old value + = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor + +error: not automatically applying `DerefMut` on `ManuallyDrop` union field + --> $DIR/union-deref.rs:23:19 + | +LL | unsafe { &mut u.f.0.0 }; + | ^^^^^ + | + = help: writing to this reference calls the destructor for the old value + = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor + +error: not automatically applying `DerefMut` on `ManuallyDrop` union field + --> $DIR/union-deref.rs:25:14 + | +LL | unsafe { u.f.0.0.push(0) }; + | ^^^^^ + | + = help: writing to this reference calls the destructor for the old value + = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor + +error: aborting due to 6 previous errors + diff --git a/tests/ui/union/union-deref.thirunsafeck.stderr b/tests/ui/union/union-deref.thirunsafeck.stderr deleted file mode 100644 index be5e60ab88a..00000000000 --- a/tests/ui/union/union-deref.thirunsafeck.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:16:14 - | -LL | unsafe { u.f.0 = Vec::new() }; - | ^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:18:19 - | -LL | unsafe { &mut u.f.0 }; - | ^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:20:14 - | -LL | unsafe { u.f.0.push(0) }; - | ^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:24:14 - | -LL | unsafe { u.f.0.0 = Vec::new() }; - | ^^^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:26:19 - | -LL | unsafe { &mut u.f.0.0 }; - | ^^^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:28:14 - | -LL | unsafe { u.f.0.0.push(0) }; - | ^^^^^ - | - = help: writing to this reference calls the destructor for the old value - = help: add an explicit `*` if that is desired, or call `ptr::write` to not run the destructor - -error: aborting due to 6 previous errors - diff --git a/tests/ui/union/union-derive-clone.mirunsafeck.stderr b/tests/ui/union/union-derive-clone.mirunsafeck.stderr deleted file mode 100644 index 4d23d230fa3..00000000000 --- a/tests/ui/union/union-derive-clone.mirunsafeck.stderr +++ /dev/null @@ -1,45 +0,0 @@ -error[E0277]: the trait bound `U1: Copy` is not satisfied - --> $DIR/union-derive-clone.rs:6:10 - | -LL | #[derive(Clone)] - | ^^^^^ the trait `Copy` is not implemented for `U1` - | -note: required by a bound in `AssertParamIsCopy` - --> $SRC_DIR/core/src/clone.rs:LL:COL - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `U1` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | union U1 { - | - -error[E0599]: the method `clone` exists for union `U5`, but its trait bounds were not satisfied - --> $DIR/union-derive-clone.rs:38:15 - | -LL | union U5 { - | ----------- - | | - | method `clone` not found for this union - | doesn't satisfy `U5: Clone` -... -LL | struct CloneNoCopy; - | ------------------ doesn't satisfy `CloneNoCopy: Copy` -... -LL | let w = u.clone(); - | ^^^^^ method cannot be called on `U5` due to unsatisfied trait bounds - | -note: trait bound `CloneNoCopy: Copy` was not satisfied - --> $DIR/union-derive-clone.rs:28:10 - | -LL | #[derive(Clone, Copy)] - | ^^^^^ unsatisfied trait bound introduced in this `derive` macro -help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]` - | -LL + #[derive(Clone, Copy)] -LL | struct CloneNoCopy; - | - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0599. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-derive-clone.rs b/tests/ui/union/union-derive-clone.rs index 7aa62146e54..7ab19edb471 100644 --- a/tests/ui/union/union-derive-clone.rs +++ b/tests/ui/union/union-derive-clone.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - use std::mem::ManuallyDrop; #[derive(Clone)] //~ ERROR the trait bound `U1: Copy` is not satisfied diff --git a/tests/ui/union/union-derive-clone.stderr b/tests/ui/union/union-derive-clone.stderr new file mode 100644 index 00000000000..39f1e32e6eb --- /dev/null +++ b/tests/ui/union/union-derive-clone.stderr @@ -0,0 +1,45 @@ +error[E0277]: the trait bound `U1: Copy` is not satisfied + --> $DIR/union-derive-clone.rs:3:10 + | +LL | #[derive(Clone)] + | ^^^^^ the trait `Copy` is not implemented for `U1` + | +note: required by a bound in `AssertParamIsCopy` + --> $SRC_DIR/core/src/clone.rs:LL:COL + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `U1` with `#[derive(Copy)]` + | +LL + #[derive(Copy)] +LL | union U1 { + | + +error[E0599]: the method `clone` exists for union `U5`, but its trait bounds were not satisfied + --> $DIR/union-derive-clone.rs:35:15 + | +LL | union U5 { + | ----------- + | | + | method `clone` not found for this union + | doesn't satisfy `U5: Clone` +... +LL | struct CloneNoCopy; + | ------------------ doesn't satisfy `CloneNoCopy: Copy` +... +LL | let w = u.clone(); + | ^^^^^ method cannot be called on `U5` due to unsatisfied trait bounds + | +note: trait bound `CloneNoCopy: Copy` was not satisfied + --> $DIR/union-derive-clone.rs:25:10 + | +LL | #[derive(Clone, Copy)] + | ^^^^^ unsatisfied trait bound introduced in this `derive` macro +help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]` + | +LL + #[derive(Clone, Copy)] +LL | struct CloneNoCopy; + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0599. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-derive-clone.thirunsafeck.stderr b/tests/ui/union/union-derive-clone.thirunsafeck.stderr deleted file mode 100644 index 4d23d230fa3..00000000000 --- a/tests/ui/union/union-derive-clone.thirunsafeck.stderr +++ /dev/null @@ -1,45 +0,0 @@ -error[E0277]: the trait bound `U1: Copy` is not satisfied - --> $DIR/union-derive-clone.rs:6:10 - | -LL | #[derive(Clone)] - | ^^^^^ the trait `Copy` is not implemented for `U1` - | -note: required by a bound in `AssertParamIsCopy` - --> $SRC_DIR/core/src/clone.rs:LL:COL - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `U1` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | union U1 { - | - -error[E0599]: the method `clone` exists for union `U5`, but its trait bounds were not satisfied - --> $DIR/union-derive-clone.rs:38:15 - | -LL | union U5 { - | ----------- - | | - | method `clone` not found for this union - | doesn't satisfy `U5: Clone` -... -LL | struct CloneNoCopy; - | ------------------ doesn't satisfy `CloneNoCopy: Copy` -... -LL | let w = u.clone(); - | ^^^^^ method cannot be called on `U5` due to unsatisfied trait bounds - | -note: trait bound `CloneNoCopy: Copy` was not satisfied - --> $DIR/union-derive-clone.rs:28:10 - | -LL | #[derive(Clone, Copy)] - | ^^^^^ unsatisfied trait bound introduced in this `derive` macro -help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]` - | -LL + #[derive(Clone, Copy)] -LL | struct CloneNoCopy; - | - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0599. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-derive-eq.mirunsafeck.stderr b/tests/ui/union/union-derive-eq.mirunsafeck.stderr deleted file mode 100644 index 86e7c955d2e..00000000000 --- a/tests/ui/union/union-derive-eq.mirunsafeck.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0277]: the trait bound `PartialEqNotEq: Eq` is not satisfied - --> $DIR/union-derive-eq.rs:16:5 - | -LL | #[derive(Eq)] - | -- in this derive macro expansion -LL | union U2 { -LL | a: PartialEqNotEq, - | ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq` - | -note: required by a bound in `AssertParamIsEq` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` - | -LL + #[derive(Eq)] -LL | struct PartialEqNotEq; - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-derive-eq.rs b/tests/ui/union/union-derive-eq.rs index b7e7f343f8a..e689f8c27d7 100644 --- a/tests/ui/union/union-derive-eq.rs +++ b/tests/ui/union/union-derive-eq.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #[derive(Eq)] // OK union U1 { a: u8, diff --git a/tests/ui/union/union-derive-eq.stderr b/tests/ui/union/union-derive-eq.stderr new file mode 100644 index 00000000000..b068edd6d69 --- /dev/null +++ b/tests/ui/union/union-derive-eq.stderr @@ -0,0 +1,21 @@ +error[E0277]: the trait bound `PartialEqNotEq: Eq` is not satisfied + --> $DIR/union-derive-eq.rs:13:5 + | +LL | #[derive(Eq)] + | -- in this derive macro expansion +LL | union U2 { +LL | a: PartialEqNotEq, + | ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq` + | +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` + | +LL + #[derive(Eq)] +LL | struct PartialEqNotEq; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-derive-eq.thirunsafeck.stderr b/tests/ui/union/union-derive-eq.thirunsafeck.stderr deleted file mode 100644 index 86e7c955d2e..00000000000 --- a/tests/ui/union/union-derive-eq.thirunsafeck.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0277]: the trait bound `PartialEqNotEq: Eq` is not satisfied - --> $DIR/union-derive-eq.rs:16:5 - | -LL | #[derive(Eq)] - | -- in this derive macro expansion -LL | union U2 { -LL | a: PartialEqNotEq, - | ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq` - | -note: required by a bound in `AssertParamIsEq` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` - | -LL + #[derive(Eq)] -LL | struct PartialEqNotEq; - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-derive-rpass.rs b/tests/ui/union/union-derive-rpass.rs index 8276bc635fc..826b9e5a7c6 100644 --- a/tests/ui/union/union-derive-rpass.rs +++ b/tests/ui/union/union-derive-rpass.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] #![allow(unused_variables)] diff --git a/tests/ui/union/union-drop.rs b/tests/ui/union/union-drop.rs index c3d7d41ca35..41c1e9243f7 100644 --- a/tests/ui/union/union-drop.rs +++ b/tests/ui/union/union-drop.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] #![allow(unused_variables)] diff --git a/tests/ui/union/union-fields-1.mirunsafeck.stderr b/tests/ui/union/union-fields-1.mirunsafeck.stderr deleted file mode 100644 index 0c9981c69fc..00000000000 --- a/tests/ui/union/union-fields-1.mirunsafeck.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error: field `c` is never read - --> $DIR/union-fields-1.rs:9:5 - | -LL | union U1 { - | -- field in this union -... -LL | c: u8, - | ^ - | -note: the lint level is defined here - --> $DIR/union-fields-1.rs:4:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: field `a` is never read - --> $DIR/union-fields-1.rs:12:5 - | -LL | union U2 { - | -- field in this union -LL | a: u8, - | ^ - -error: field `a` is never read - --> $DIR/union-fields-1.rs:16:20 - | -LL | union NoDropLike { a: u8 } - | ---------- ^ - | | - | field in this union - -error: field `c` is never read - --> $DIR/union-fields-1.rs:21:5 - | -LL | union U { - | - field in this union -... -LL | c: u8, - | ^ - -error: aborting due to 4 previous errors - diff --git a/tests/ui/union/union-fields-1.rs b/tests/ui/union/union-fields-1.rs index cf2ef4c03d6..8ab34b55da2 100644 --- a/tests/ui/union/union-fields-1.rs +++ b/tests/ui/union/union-fields-1.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![deny(dead_code)] union U1 { diff --git a/tests/ui/union/union-fields-1.stderr b/tests/ui/union/union-fields-1.stderr new file mode 100644 index 00000000000..bba8aae6024 --- /dev/null +++ b/tests/ui/union/union-fields-1.stderr @@ -0,0 +1,42 @@ +error: field `c` is never read + --> $DIR/union-fields-1.rs:6:5 + | +LL | union U1 { + | -- field in this union +... +LL | c: u8, + | ^ + | +note: the lint level is defined here + --> $DIR/union-fields-1.rs:1:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: field `a` is never read + --> $DIR/union-fields-1.rs:9:5 + | +LL | union U2 { + | -- field in this union +LL | a: u8, + | ^ + +error: field `a` is never read + --> $DIR/union-fields-1.rs:13:20 + | +LL | union NoDropLike { a: u8 } + | ---------- ^ + | | + | field in this union + +error: field `c` is never read + --> $DIR/union-fields-1.rs:18:5 + | +LL | union U { + | - field in this union +... +LL | c: u8, + | ^ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/union/union-fields-1.thirunsafeck.stderr b/tests/ui/union/union-fields-1.thirunsafeck.stderr deleted file mode 100644 index 0c9981c69fc..00000000000 --- a/tests/ui/union/union-fields-1.thirunsafeck.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error: field `c` is never read - --> $DIR/union-fields-1.rs:9:5 - | -LL | union U1 { - | -- field in this union -... -LL | c: u8, - | ^ - | -note: the lint level is defined here - --> $DIR/union-fields-1.rs:4:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: field `a` is never read - --> $DIR/union-fields-1.rs:12:5 - | -LL | union U2 { - | -- field in this union -LL | a: u8, - | ^ - -error: field `a` is never read - --> $DIR/union-fields-1.rs:16:20 - | -LL | union NoDropLike { a: u8 } - | ---------- ^ - | | - | field in this union - -error: field `c` is never read - --> $DIR/union-fields-1.rs:21:5 - | -LL | union U { - | - field in this union -... -LL | c: u8, - | ^ - -error: aborting due to 4 previous errors - diff --git a/tests/ui/union/union-fields-2.mirunsafeck.stderr b/tests/ui/union/union-fields-2.mirunsafeck.stderr deleted file mode 100644 index 1157f0c2ae7..00000000000 --- a/tests/ui/union/union-fields-2.mirunsafeck.stderr +++ /dev/null @@ -1,84 +0,0 @@ -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:10:13 - | -LL | let u = U {}; - | ^ - -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:12:13 - | -LL | let u = U { a: 0, b: 1 }; - | ^ - -error[E0560]: union `U` has no field named `c` - --> $DIR/union-fields-2.rs:13:29 - | -LL | let u = U { a: 0, b: 1, c: 2 }; - | ^ `U` does not have this field - | - = note: all struct fields are already assigned - -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:13:13 - | -LL | let u = U { a: 0, b: 1, c: 2 }; - | ^ - -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:15:13 - | -LL | let u = U { ..u }; - | ^ - -error[E0436]: functional record update syntax requires a struct - --> $DIR/union-fields-2.rs:15:19 - | -LL | let u = U { ..u }; - | ^ - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:18:9 - | -LL | let U {} = u; - | ^^^^ - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:20:9 - | -LL | let U { a, b } = u; - | ^^^^^^^^^^ - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:21:9 - | -LL | let U { a, b, c } = u; - | ^^^^^^^^^^^^^ - -error[E0026]: union `U` does not have a field named `c` - --> $DIR/union-fields-2.rs:21:19 - | -LL | let U { a, b, c } = u; - | ^ union `U` does not have this field - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:23:9 - | -LL | let U { .. } = u; - | ^^^^^^^^ - -error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:23:9 - | -LL | let U { .. } = u; - | ^^^^^^^^ - -error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:25:9 - | -LL | let U { a, .. } = u; - | ^^^^^^^^^^^ - -error: aborting due to 13 previous errors - -Some errors have detailed explanations: E0026, E0436, E0560, E0784. -For more information about an error, try `rustc --explain E0026`. diff --git a/tests/ui/union/union-fields-2.rs b/tests/ui/union/union-fields-2.rs index e738b184703..71b204fcdc5 100644 --- a/tests/ui/union/union-fields-2.rs +++ b/tests/ui/union/union-fields-2.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - union U { a: u8, b: u16, diff --git a/tests/ui/union/union-fields-2.stderr b/tests/ui/union/union-fields-2.stderr new file mode 100644 index 00000000000..142186885ca --- /dev/null +++ b/tests/ui/union/union-fields-2.stderr @@ -0,0 +1,84 @@ +error[E0784]: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:7:13 + | +LL | let u = U {}; + | ^ + +error[E0784]: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:9:13 + | +LL | let u = U { a: 0, b: 1 }; + | ^ + +error[E0560]: union `U` has no field named `c` + --> $DIR/union-fields-2.rs:10:29 + | +LL | let u = U { a: 0, b: 1, c: 2 }; + | ^ `U` does not have this field + | + = note: all struct fields are already assigned + +error[E0784]: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:10:13 + | +LL | let u = U { a: 0, b: 1, c: 2 }; + | ^ + +error[E0784]: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:12:13 + | +LL | let u = U { ..u }; + | ^ + +error[E0436]: functional record update syntax requires a struct + --> $DIR/union-fields-2.rs:12:19 + | +LL | let u = U { ..u }; + | ^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:15:9 + | +LL | let U {} = u; + | ^^^^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:17:9 + | +LL | let U { a, b } = u; + | ^^^^^^^^^^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:18:9 + | +LL | let U { a, b, c } = u; + | ^^^^^^^^^^^^^ + +error[E0026]: union `U` does not have a field named `c` + --> $DIR/union-fields-2.rs:18:19 + | +LL | let U { a, b, c } = u; + | ^ union `U` does not have this field + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:20:9 + | +LL | let U { .. } = u; + | ^^^^^^^^ + +error: `..` cannot be used in union patterns + --> $DIR/union-fields-2.rs:20:9 + | +LL | let U { .. } = u; + | ^^^^^^^^ + +error: `..` cannot be used in union patterns + --> $DIR/union-fields-2.rs:22:9 + | +LL | let U { a, .. } = u; + | ^^^^^^^^^^^ + +error: aborting due to 13 previous errors + +Some errors have detailed explanations: E0026, E0436, E0560, E0784. +For more information about an error, try `rustc --explain E0026`. diff --git a/tests/ui/union/union-fields-2.thirunsafeck.stderr b/tests/ui/union/union-fields-2.thirunsafeck.stderr deleted file mode 100644 index 1157f0c2ae7..00000000000 --- a/tests/ui/union/union-fields-2.thirunsafeck.stderr +++ /dev/null @@ -1,84 +0,0 @@ -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:10:13 - | -LL | let u = U {}; - | ^ - -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:12:13 - | -LL | let u = U { a: 0, b: 1 }; - | ^ - -error[E0560]: union `U` has no field named `c` - --> $DIR/union-fields-2.rs:13:29 - | -LL | let u = U { a: 0, b: 1, c: 2 }; - | ^ `U` does not have this field - | - = note: all struct fields are already assigned - -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:13:13 - | -LL | let u = U { a: 0, b: 1, c: 2 }; - | ^ - -error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:15:13 - | -LL | let u = U { ..u }; - | ^ - -error[E0436]: functional record update syntax requires a struct - --> $DIR/union-fields-2.rs:15:19 - | -LL | let u = U { ..u }; - | ^ - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:18:9 - | -LL | let U {} = u; - | ^^^^ - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:20:9 - | -LL | let U { a, b } = u; - | ^^^^^^^^^^ - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:21:9 - | -LL | let U { a, b, c } = u; - | ^^^^^^^^^^^^^ - -error[E0026]: union `U` does not have a field named `c` - --> $DIR/union-fields-2.rs:21:19 - | -LL | let U { a, b, c } = u; - | ^ union `U` does not have this field - -error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:23:9 - | -LL | let U { .. } = u; - | ^^^^^^^^ - -error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:23:9 - | -LL | let U { .. } = u; - | ^^^^^^^^ - -error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:25:9 - | -LL | let U { a, .. } = u; - | ^^^^^^^^^^^ - -error: aborting due to 13 previous errors - -Some errors have detailed explanations: E0026, E0436, E0560, E0784. -For more information about an error, try `rustc --explain E0026`. diff --git a/tests/ui/union/union-generic-rpass.rs b/tests/ui/union/union-generic-rpass.rs index 25f1f5050f9..69837f31cab 100644 --- a/tests/ui/union/union-generic-rpass.rs +++ b/tests/ui/union/union-generic-rpass.rs @@ -1,7 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![allow(dead_code)] use std::mem::ManuallyDrop; diff --git a/tests/ui/union/union-generic.mirunsafeck.stderr b/tests/ui/union/union-generic.mirunsafeck.stderr deleted file mode 100644 index 037022a91fc..00000000000 --- a/tests/ui/union/union-generic.mirunsafeck.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:11:13 - | -LL | let u = U { a: Rc::new(0u32) }; - | ^ the trait `Copy` is not implemented for `Rc` - | -note: required by a bound in `U` - --> $DIR/union-generic.rs:6:12 - | -LL | union U { - | ^^^^ required by this bound in `U` - -error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:13:17 - | -LL | let u = U::> { a: Default::default() }; - | ^^^^^^^ the trait `Copy` is not implemented for `Rc` - | -note: required by a bound in `U` - --> $DIR/union-generic.rs:6:12 - | -LL | union U { - | ^^^^ required by this bound in `U` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-generic.rs b/tests/ui/union/union-generic.rs index 3d68ecb87d8..ff877892579 100644 --- a/tests/ui/union/union-generic.rs +++ b/tests/ui/union/union-generic.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - use std::rc::Rc; union U { diff --git a/tests/ui/union/union-generic.stderr b/tests/ui/union/union-generic.stderr new file mode 100644 index 00000000000..b9d4aee787e --- /dev/null +++ b/tests/ui/union/union-generic.stderr @@ -0,0 +1,27 @@ +error[E0277]: the trait bound `Rc: Copy` is not satisfied + --> $DIR/union-generic.rs:8:13 + | +LL | let u = U { a: Rc::new(0u32) }; + | ^ the trait `Copy` is not implemented for `Rc` + | +note: required by a bound in `U` + --> $DIR/union-generic.rs:3:12 + | +LL | union U { + | ^^^^ required by this bound in `U` + +error[E0277]: the trait bound `Rc: Copy` is not satisfied + --> $DIR/union-generic.rs:10:17 + | +LL | let u = U::> { a: Default::default() }; + | ^^^^^^^ the trait `Copy` is not implemented for `Rc` + | +note: required by a bound in `U` + --> $DIR/union-generic.rs:3:12 + | +LL | union U { + | ^^^^ required by this bound in `U` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-generic.thirunsafeck.stderr b/tests/ui/union/union-generic.thirunsafeck.stderr deleted file mode 100644 index 037022a91fc..00000000000 --- a/tests/ui/union/union-generic.thirunsafeck.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:11:13 - | -LL | let u = U { a: Rc::new(0u32) }; - | ^ the trait `Copy` is not implemented for `Rc` - | -note: required by a bound in `U` - --> $DIR/union-generic.rs:6:12 - | -LL | union U { - | ^^^^ required by this bound in `U` - -error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:13:17 - | -LL | let u = U::> { a: Default::default() }; - | ^^^^^^^ the trait `Copy` is not implemented for `Rc` - | -note: required by a bound in `U` - --> $DIR/union-generic.rs:6:12 - | -LL | union U { - | ^^^^ required by this bound in `U` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-inherent-method.rs b/tests/ui/union/union-inherent-method.rs index b0fd22da73a..2e75cce7b10 100644 --- a/tests/ui/union/union-inherent-method.rs +++ b/tests/ui/union/union-inherent-method.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck union U { a: u8, diff --git a/tests/ui/union/union-lint-dead-code.mirunsafeck.stderr b/tests/ui/union/union-lint-dead-code.mirunsafeck.stderr deleted file mode 100644 index 8a3677d525d..00000000000 --- a/tests/ui/union/union-lint-dead-code.mirunsafeck.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: field `b` is never read - --> $DIR/union-lint-dead-code.rs:8:5 - | -LL | union Foo { - | --- field in this union -LL | x: usize, -LL | b: bool, - | ^ - | -note: the lint level is defined here - --> $DIR/union-lint-dead-code.rs:4:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/union/union-lint-dead-code.rs b/tests/ui/union/union-lint-dead-code.rs index 65aaf0a1d35..cb2cdd4dba0 100644 --- a/tests/ui/union/union-lint-dead-code.rs +++ b/tests/ui/union/union-lint-dead-code.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![deny(dead_code)] union Foo { diff --git a/tests/ui/union/union-lint-dead-code.stderr b/tests/ui/union/union-lint-dead-code.stderr new file mode 100644 index 00000000000..691a5e19ae6 --- /dev/null +++ b/tests/ui/union/union-lint-dead-code.stderr @@ -0,0 +1,17 @@ +error: field `b` is never read + --> $DIR/union-lint-dead-code.rs:5:5 + | +LL | union Foo { + | --- field in this union +LL | x: usize, +LL | b: bool, + | ^ + | +note: the lint level is defined here + --> $DIR/union-lint-dead-code.rs:1:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/union/union-lint-dead-code.thirunsafeck.stderr b/tests/ui/union/union-lint-dead-code.thirunsafeck.stderr deleted file mode 100644 index 8a3677d525d..00000000000 --- a/tests/ui/union/union-lint-dead-code.thirunsafeck.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: field `b` is never read - --> $DIR/union-lint-dead-code.rs:8:5 - | -LL | union Foo { - | --- field in this union -LL | x: usize, -LL | b: bool, - | ^ - | -note: the lint level is defined here - --> $DIR/union-lint-dead-code.rs:4:9 - | -LL | #![deny(dead_code)] - | ^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/union/union-macro.rs b/tests/ui/union/union-macro.rs index 7fd9d8221c6..5ca013a44cd 100644 --- a/tests/ui/union/union-macro.rs +++ b/tests/ui/union/union-macro.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(unused_variables)] diff --git a/tests/ui/union/union-manuallydrop-rpass.rs b/tests/ui/union/union-manuallydrop-rpass.rs index 826bdf07cef..ba99e7441e6 100644 --- a/tests/ui/union/union-manuallydrop-rpass.rs +++ b/tests/ui/union/union-manuallydrop-rpass.rs @@ -1,7 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![allow(dead_code)] use std::mem::needs_drop; @@ -28,9 +25,9 @@ union UnionOk3 { value: T, } -trait Foo { } +trait Foo {} -trait ImpliesCopy : Copy { } +trait ImpliesCopy: Copy {} #[allow(dead_code)] union UnionOk4 { diff --git a/tests/ui/union/union-move.mirunsafeck.stderr b/tests/ui/union/union-move.mirunsafeck.stderr deleted file mode 100644 index 6381ae874ba..00000000000 --- a/tests/ui/union/union-move.mirunsafeck.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0382]: use of moved value: `x` - --> $DIR/union-move.rs:29:18 - | -LL | fn test1(x: U1) { - | - move occurs because `x` has type `U1`, which does not implement the `Copy` trait -... -LL | move_out(x.f1_nocopy); - | ----------- value moved here -LL | move_out(x.f2_nocopy); - | ^^^^^^^^^^^ value used here after move - | -note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary - --> $DIR/union-move.rs:10:19 - | -LL | fn move_out(x: T) {} - | -------- ^ this parameter takes ownership of the value - | | - | in this function - -error[E0382]: use of moved value: `x` - --> $DIR/union-move.rs:45:18 - | -LL | fn test3(x: U1) { - | - move occurs because `x` has type `U1`, which does not implement the `Copy` trait -... -LL | move_out(x.f2_nocopy); - | ----------- value moved here -LL | move_out(x.f3_copy); - | ^^^^^^^^^ value used here after move - | -note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary - --> $DIR/union-move.rs:10:19 - | -LL | fn move_out(x: T) {} - | -------- ^ this parameter takes ownership of the value - | | - | in this function - -error[E0509]: cannot move out of type `U2`, which implements the `Drop` trait - --> $DIR/union-move.rs:52:18 - | -LL | move_out(x.f1_nocopy); - | ^^^^^^^^^^^ - | | - | cannot move out of here - | move occurs because `x.f1_nocopy` has type `ManuallyDrop>`, which does not implement the `Copy` trait - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0382, E0509. -For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/union/union-move.rs b/tests/ui/union/union-move.rs index b8b1ac8046a..76220a7d40a 100644 --- a/tests/ui/union/union-move.rs +++ b/tests/ui/union/union-move.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - //! Test the behavior of moving out of non-`Copy` union fields. //! Avoid types that `Drop`, we want to focus on moving. diff --git a/tests/ui/union/union-move.stderr b/tests/ui/union/union-move.stderr new file mode 100644 index 00000000000..47fb801a50e --- /dev/null +++ b/tests/ui/union/union-move.stderr @@ -0,0 +1,51 @@ +error[E0382]: use of moved value: `x` + --> $DIR/union-move.rs:26:18 + | +LL | fn test1(x: U1) { + | - move occurs because `x` has type `U1`, which does not implement the `Copy` trait +... +LL | move_out(x.f1_nocopy); + | ----------- value moved here +LL | move_out(x.f2_nocopy); + | ^^^^^^^^^^^ value used here after move + | +note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary + --> $DIR/union-move.rs:7:19 + | +LL | fn move_out(x: T) {} + | -------- ^ this parameter takes ownership of the value + | | + | in this function + +error[E0382]: use of moved value: `x` + --> $DIR/union-move.rs:42:18 + | +LL | fn test3(x: U1) { + | - move occurs because `x` has type `U1`, which does not implement the `Copy` trait +... +LL | move_out(x.f2_nocopy); + | ----------- value moved here +LL | move_out(x.f3_copy); + | ^^^^^^^^^ value used here after move + | +note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary + --> $DIR/union-move.rs:7:19 + | +LL | fn move_out(x: T) {} + | -------- ^ this parameter takes ownership of the value + | | + | in this function + +error[E0509]: cannot move out of type `U2`, which implements the `Drop` trait + --> $DIR/union-move.rs:49:18 + | +LL | move_out(x.f1_nocopy); + | ^^^^^^^^^^^ + | | + | cannot move out of here + | move occurs because `x.f1_nocopy` has type `ManuallyDrop>`, which does not implement the `Copy` trait + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0382, E0509. +For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/union/union-move.thirunsafeck.stderr b/tests/ui/union/union-move.thirunsafeck.stderr deleted file mode 100644 index 6381ae874ba..00000000000 --- a/tests/ui/union/union-move.thirunsafeck.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0382]: use of moved value: `x` - --> $DIR/union-move.rs:29:18 - | -LL | fn test1(x: U1) { - | - move occurs because `x` has type `U1`, which does not implement the `Copy` trait -... -LL | move_out(x.f1_nocopy); - | ----------- value moved here -LL | move_out(x.f2_nocopy); - | ^^^^^^^^^^^ value used here after move - | -note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary - --> $DIR/union-move.rs:10:19 - | -LL | fn move_out(x: T) {} - | -------- ^ this parameter takes ownership of the value - | | - | in this function - -error[E0382]: use of moved value: `x` - --> $DIR/union-move.rs:45:18 - | -LL | fn test3(x: U1) { - | - move occurs because `x` has type `U1`, which does not implement the `Copy` trait -... -LL | move_out(x.f2_nocopy); - | ----------- value moved here -LL | move_out(x.f3_copy); - | ^^^^^^^^^ value used here after move - | -note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary - --> $DIR/union-move.rs:10:19 - | -LL | fn move_out(x: T) {} - | -------- ^ this parameter takes ownership of the value - | | - | in this function - -error[E0509]: cannot move out of type `U2`, which implements the `Drop` trait - --> $DIR/union-move.rs:52:18 - | -LL | move_out(x.f1_nocopy); - | ^^^^^^^^^^^ - | | - | cannot move out of here - | move occurs because `x.f1_nocopy` has type `ManuallyDrop>`, which does not implement the `Copy` trait - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0382, E0509. -For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/union/union-nodrop.rs b/tests/ui/union/union-nodrop.rs index 6e6b105a73e..7ce17a7c825 100644 --- a/tests/ui/union/union-nodrop.rs +++ b/tests/ui/union/union-nodrop.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] @@ -19,10 +17,14 @@ static X: () = (NoDrop { inner: ManuallyDrop::new(NeedDrop) }, ()).1; const Y: () = (NoDrop { inner: ManuallyDrop::new(NeedDrop) }, ()).1; -const fn _f() { (NoDrop { inner: ManuallyDrop::new(NeedDrop) }, ()).1 } +const fn _f() { + (NoDrop { inner: ManuallyDrop::new(NeedDrop) }, ()).1 +} // A union that scrubs the drop glue from its inner type -union NoDrop { inner: ManuallyDrop } +union NoDrop { + inner: ManuallyDrop, +} // Copy currently can't be implemented on drop-containing unions, // this may change later @@ -35,7 +37,7 @@ union NoDrop { inner: ManuallyDrop } // // We should be able to implement Copy for things using NoDrop // #[derive(Copy, Clone)] struct Foo { - x: NoDrop> + x: NoDrop>, } struct Baz { @@ -43,7 +45,9 @@ struct Baz { y: Box, } -union ActuallyDrop { inner: ManuallyDrop } +union ActuallyDrop { + inner: ManuallyDrop, +} impl Drop for ActuallyDrop { fn drop(&mut self) {} diff --git a/tests/ui/union/union-nonzero.rs b/tests/ui/union/union-nonzero.rs index 3f4f7ea1c10..e7ab4ebe323 100644 --- a/tests/ui/union/union-nonzero.rs +++ b/tests/ui/union/union-nonzero.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] diff --git a/tests/ui/union/union-overwrite.rs b/tests/ui/union/union-overwrite.rs index 0eea14d9de0..399ed9ae458 100644 --- a/tests/ui/union/union-overwrite.rs +++ b/tests/ui/union/union-overwrite.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #[repr(C)] #[derive(Copy, Clone)] diff --git a/tests/ui/union/union-packed.rs b/tests/ui/union/union-packed.rs index 9c6398bf5aa..538c337a773 100644 --- a/tests/ui/union/union-packed.rs +++ b/tests/ui/union/union-packed.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/tests/ui/union/union-pat-refutability.rs b/tests/ui/union/union-pat-refutability.rs index d628a200a07..17ac6c6dfa9 100644 --- a/tests/ui/union/union-pat-refutability.rs +++ b/tests/ui/union/union-pat-refutability.rs @@ -1,12 +1,13 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(dead_code)] #![allow(illegal_floating_point_literal_pattern)] #[repr(u32)] -enum Tag { I, F } +enum Tag { + I, + F, +} #[repr(C)] union U { diff --git a/tests/ui/union/union-suggest-field.mirunsafeck.stderr b/tests/ui/union/union-suggest-field.mirunsafeck.stderr deleted file mode 100644 index efe4987bd02..00000000000 --- a/tests/ui/union/union-suggest-field.mirunsafeck.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0560]: union `U` has no field named `principle` - --> $DIR/union-suggest-field.rs:13:17 - | -LL | let u = U { principle: 0 }; - | ^^^^^^^^^ unknown field - | -help: a field with a similar name exists - | -LL | let u = U { principal: 0 }; - | ~~~~~~~~~ - -error[E0609]: no field `principial` on type `U` - --> $DIR/union-suggest-field.rs:17:15 - | -LL | let w = u.principial; - | ^^^^^^^^^^ unknown field - | -help: a field with a similar name exists - | -LL | let w = u.principal; - | ~~~~~~~~~ - -error[E0615]: attempted to take value of method `calculate` on type `U` - --> $DIR/union-suggest-field.rs:21:15 - | -LL | let y = u.calculate; - | ^^^^^^^^^ method, not a field - | -help: use parentheses to call the method - | -LL | let y = u.calculate(); - | ++ - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0560, E0609, E0615. -For more information about an error, try `rustc --explain E0560`. diff --git a/tests/ui/union/union-suggest-field.rs b/tests/ui/union/union-suggest-field.rs index 601a22a0600..71b93e873c2 100644 --- a/tests/ui/union/union-suggest-field.rs +++ b/tests/ui/union/union-suggest-field.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - union U { principal: u8, } diff --git a/tests/ui/union/union-suggest-field.stderr b/tests/ui/union/union-suggest-field.stderr new file mode 100644 index 00000000000..5c428cf6c89 --- /dev/null +++ b/tests/ui/union/union-suggest-field.stderr @@ -0,0 +1,37 @@ +error[E0560]: union `U` has no field named `principle` + --> $DIR/union-suggest-field.rs:10:17 + | +LL | let u = U { principle: 0 }; + | ^^^^^^^^^ unknown field + | +help: a field with a similar name exists + | +LL | let u = U { principal: 0 }; + | ~~~~~~~~~ + +error[E0609]: no field `principial` on type `U` + --> $DIR/union-suggest-field.rs:14:15 + | +LL | let w = u.principial; + | ^^^^^^^^^^ unknown field + | +help: a field with a similar name exists + | +LL | let w = u.principal; + | ~~~~~~~~~ + +error[E0615]: attempted to take value of method `calculate` on type `U` + --> $DIR/union-suggest-field.rs:18:15 + | +LL | let y = u.calculate; + | ^^^^^^^^^ method, not a field + | +help: use parentheses to call the method + | +LL | let y = u.calculate(); + | ++ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0560, E0609, E0615. +For more information about an error, try `rustc --explain E0560`. diff --git a/tests/ui/union/union-suggest-field.thirunsafeck.stderr b/tests/ui/union/union-suggest-field.thirunsafeck.stderr deleted file mode 100644 index efe4987bd02..00000000000 --- a/tests/ui/union/union-suggest-field.thirunsafeck.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0560]: union `U` has no field named `principle` - --> $DIR/union-suggest-field.rs:13:17 - | -LL | let u = U { principle: 0 }; - | ^^^^^^^^^ unknown field - | -help: a field with a similar name exists - | -LL | let u = U { principal: 0 }; - | ~~~~~~~~~ - -error[E0609]: no field `principial` on type `U` - --> $DIR/union-suggest-field.rs:17:15 - | -LL | let w = u.principial; - | ^^^^^^^^^^ unknown field - | -help: a field with a similar name exists - | -LL | let w = u.principal; - | ~~~~~~~~~ - -error[E0615]: attempted to take value of method `calculate` on type `U` - --> $DIR/union-suggest-field.rs:21:15 - | -LL | let y = u.calculate; - | ^^^^^^^^^ method, not a field - | -help: use parentheses to call the method - | -LL | let y = u.calculate(); - | ++ - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0560, E0609, E0615. -For more information about an error, try `rustc --explain E0560`. diff --git a/tests/ui/union/union-trait-impl.rs b/tests/ui/union/union-trait-impl.rs index 6134e91f31e..8a7ac817240 100644 --- a/tests/ui/union/union-trait-impl.rs +++ b/tests/ui/union/union-trait-impl.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck use std::fmt; diff --git a/tests/ui/union/union-transmute.rs b/tests/ui/union/union-transmute.rs index 1a3b32d55f3..be8062f6276 100644 --- a/tests/ui/union/union-transmute.rs +++ b/tests/ui/union/union-transmute.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck union U { a: (u8, u8), diff --git a/tests/ui/union/union-unsafe.mir.stderr b/tests/ui/union/union-unsafe.mir.stderr deleted file mode 100644 index 15f059ffa48..00000000000 --- a/tests/ui/union/union-unsafe.mir.stderr +++ /dev/null @@ -1,83 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:34:5 - | -LL | *(u.p) = 13; - | ^^^^^^^^^^^ 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-unsafe.rs:47:6 - | -LL | *u3.a = T::default(); - | ^^^^ 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-unsafe.rs:53:6 - | -LL | *u3.a = T::default(); - | ^^^^ 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-unsafe.rs:61:13 - | -LL | let a = u1.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-unsafe.rs:64:14 - | -LL | let U1 { a } = u1; - | ^ 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-unsafe.rs:65:12 - | -LL | if let U1 { a: 12 } = u1 {} - | ^^^^^^^^^^^^ 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-unsafe.rs:66:12 - | -LL | if let Some(U1 { a: 13 }) = Some(u1) {} - | ^^^^^^^^^^^^^^^^^^ 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-unsafe.rs:71:6 - | -LL | *u2.a = String::from("new"); - | ^^^^ 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-unsafe.rs:75:6 - | -LL | *u3.a = 1; - | ^^^^ 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-unsafe.rs:79:6 - | -LL | *u3.a = String::from("new"); - | ^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 10 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/union/union-unsafe.rs b/tests/ui/union/union-unsafe.rs index d1465486f77..bd3946686be 100644 --- a/tests/ui/union/union-unsafe.rs +++ b/tests/ui/union/union-unsafe.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - use std::cell::RefCell; use std::mem::ManuallyDrop; @@ -35,7 +32,6 @@ fn deref_union_field(mut u: URef) { } fn assign_noncopy_union_field(mut u: URefCell) { - // FIXME(thir-unsafeck) u.a = (ManuallyDrop::new(RefCell::new(0)), 1); // OK (assignment does not drop) u.a.0 = ManuallyDrop::new(RefCell::new(0)); // OK (assignment does not drop) u.a.1 = 1; // OK diff --git a/tests/ui/union/union-unsafe.stderr b/tests/ui/union/union-unsafe.stderr new file mode 100644 index 00000000000..4d3408a89af --- /dev/null +++ b/tests/ui/union/union-unsafe.stderr @@ -0,0 +1,83 @@ +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/union-unsafe.rs:31:5 + | +LL | *(u.p) = 13; + | ^^^^^^^^^^^ 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-unsafe.rs:43:6 + | +LL | *u3.a = T::default(); + | ^^^^ 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-unsafe.rs:49:6 + | +LL | *u3.a = T::default(); + | ^^^^ 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-unsafe.rs:57:13 + | +LL | let a = u1.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-unsafe.rs:60:14 + | +LL | let U1 { a } = u1; + | ^ 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-unsafe.rs:61:12 + | +LL | if let U1 { a: 12 } = u1 {} + | ^^^^^^^^^^^^ 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-unsafe.rs:62:12 + | +LL | if let Some(U1 { a: 13 }) = Some(u1) {} + | ^^^^^^^^^^^^^^^^^^ 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-unsafe.rs:67:6 + | +LL | *u2.a = String::from("new"); + | ^^^^ 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-unsafe.rs:71:6 + | +LL | *u3.a = 1; + | ^^^^ 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-unsafe.rs:75:6 + | +LL | *u3.a = String::from("new"); + | ^^^^ access to union field + | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior + +error: aborting due to 10 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/union/union-unsafe.thir.stderr b/tests/ui/union/union-unsafe.thir.stderr deleted file mode 100644 index 9ce835497c5..00000000000 --- a/tests/ui/union/union-unsafe.thir.stderr +++ /dev/null @@ -1,83 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:34:6 - | -LL | *(u.p) = 13; - | ^^^^^ 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-unsafe.rs:47:6 - | -LL | *u3.a = T::default(); - | ^^^^ 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-unsafe.rs:53:6 - | -LL | *u3.a = T::default(); - | ^^^^ 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-unsafe.rs:61:13 - | -LL | let a = u1.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-unsafe.rs:64:14 - | -LL | let U1 { a } = u1; - | ^ 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-unsafe.rs:65:20 - | -LL | if let U1 { a: 12 } = u1 {} - | ^^ 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-unsafe.rs:66:25 - | -LL | if let Some(U1 { a: 13 }) = Some(u1) {} - | ^^ 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-unsafe.rs:71:6 - | -LL | *u2.a = String::from("new"); - | ^^^^ 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-unsafe.rs:75:6 - | -LL | *u3.a = 1; - | ^^^^ 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-unsafe.rs:79:6 - | -LL | *u3.a = String::from("new"); - | ^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 10 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/union/union-unsized.mirunsafeck.stderr b/tests/ui/union/union-unsized.mirunsafeck.stderr deleted file mode 100644 index de7e690d80f..00000000000 --- a/tests/ui/union/union-unsized.mirunsafeck.stderr +++ /dev/null @@ -1,64 +0,0 @@ -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:5:8 - | -LL | a: str, - | ^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | a: &str, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | a: Box, - | ++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:5:5 - | -LL | a: str, - | ^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:14:8 - | -LL | b: str, - | ^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | b: &str, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | b: Box, - | ++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:14:5 - | -LL | b: str, - | ^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | b: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0277, E0740. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-unsized.rs b/tests/ui/union/union-unsized.rs index b95b2e414f3..5dd32192ab9 100644 --- a/tests/ui/union/union-unsized.rs +++ b/tests/ui/union/union-unsized.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - union U { a: str, //~^ ERROR the size for values of type diff --git a/tests/ui/union/union-unsized.stderr b/tests/ui/union/union-unsized.stderr new file mode 100644 index 00000000000..3d2e699f630 --- /dev/null +++ b/tests/ui/union/union-unsized.stderr @@ -0,0 +1,76 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/union-unsized.rs:2:8 + | +LL | a: str, + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: no field of a union may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | a: &str, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | a: Box, + | ++++ + + +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/union-unsized.rs:5:5 + | +LL | a: str, + | ^^^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | a: std::mem::ManuallyDrop, + | +++++++++++++++++++++++ + + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/union-unsized.rs:11:8 + | +LL | b: str, + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: no field of a union may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | b: &str, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | b: Box, + | ++++ + + +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/union-unsized.rs:2:5 + | +LL | a: str, + | ^^^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | a: std::mem::ManuallyDrop, + | +++++++++++++++++++++++ + + +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/union-unsized.rs:11:5 + | +LL | b: str, + | ^^^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | b: std::mem::ManuallyDrop, + | +++++++++++++++++++++++ + + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0740. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-unsized.thirunsafeck.stderr b/tests/ui/union/union-unsized.thirunsafeck.stderr deleted file mode 100644 index de7e690d80f..00000000000 --- a/tests/ui/union/union-unsized.thirunsafeck.stderr +++ /dev/null @@ -1,64 +0,0 @@ -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:5:8 - | -LL | a: str, - | ^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | a: &str, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | a: Box, - | ++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:5:5 - | -LL | a: str, - | ^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:14:8 - | -LL | b: str, - | ^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | b: &str, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | b: Box, - | ++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:14:5 - | -LL | b: str, - | ^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | b: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0277, E0740. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr b/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr deleted file mode 100644 index 9861a21cb3d..00000000000 --- a/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-with-drop-fields.rs:11:5 - | -LL | a: String, - | ^^^^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-with-drop-fields.rs:19:5 - | -LL | a: S, - | ^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-with-drop-fields.rs:24:5 - | -LL | a: T, - | ^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0740`. diff --git a/tests/ui/union/union-with-drop-fields.rs b/tests/ui/union/union-with-drop-fields.rs index 9720830fb1f..ae147e9bd2b 100644 --- a/tests/ui/union/union-with-drop-fields.rs +++ b/tests/ui/union/union-with-drop-fields.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![allow(dead_code)] union U { diff --git a/tests/ui/union/union-with-drop-fields.stderr b/tests/ui/union/union-with-drop-fields.stderr new file mode 100644 index 00000000000..6328be56540 --- /dev/null +++ b/tests/ui/union/union-with-drop-fields.stderr @@ -0,0 +1,39 @@ +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/union-with-drop-fields.rs:8:5 + | +LL | a: String, + | ^^^^^^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | a: std::mem::ManuallyDrop, + | +++++++++++++++++++++++ + + +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/union-with-drop-fields.rs:16:5 + | +LL | a: S, + | ^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | a: std::mem::ManuallyDrop, + | +++++++++++++++++++++++ + + +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/union-with-drop-fields.rs:21:5 + | +LL | a: T, + | ^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | a: std::mem::ManuallyDrop, + | +++++++++++++++++++++++ + + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0740`. diff --git a/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr b/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr deleted file mode 100644 index 9861a21cb3d..00000000000 --- a/tests/ui/union/union-with-drop-fields.thirunsafeck.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-with-drop-fields.rs:11:5 - | -LL | a: String, - | ^^^^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-with-drop-fields.rs:19:5 - | -LL | a: S, - | ^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-with-drop-fields.rs:24:5 - | -LL | a: T, - | ^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0740`. diff --git a/tests/ui/unsafe/access_union_field.mir.stderr b/tests/ui/unsafe/access_union_field.mir.stderr deleted file mode 100644 index 98bc4077793..00000000000 --- a/tests/ui/unsafe/access_union_field.mir.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/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.stderr b/tests/ui/unsafe/access_union_field.stderr new file mode 100644 index 00000000000..4c46bb44a1d --- /dev/null +++ b/tests/ui/unsafe/access_union_field.stderr @@ -0,0 +1,19 @@ +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/access_union_field.rs:10: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:11: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/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.mir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr deleted file mode 100644 index ea53bf59d31..00000000000 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: call to unsafe function 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/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.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr new file mode 100644 index 00000000000..9ca10b05090 --- /dev/null +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr @@ -0,0 +1,16 @@ +warning: call to unsafe function is unsafe and requires unsafe block (error E0133) + --> $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:9: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/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.mir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr deleted file mode 100644 index 5157dbb514b..00000000000 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 - | -LL | test::free(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. 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.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr new file mode 100644 index 00000000000..b55e6130230 --- /dev/null +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/foreign-unsafe-fn-called.rs:8: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/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.mir.stderr b/tests/ui/unsafe/inline_asm.mir.stderr deleted file mode 100644 index e38a9388a78..00000000000 --- a/tests/ui/unsafe/inline_asm.mir.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/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.stderr b/tests/ui/unsafe/inline_asm.stderr new file mode 100644 index 00000000000..1e829152a72 --- /dev/null +++ b/tests/ui/unsafe/inline_asm.stderr @@ -0,0 +1,11 @@ +error[E0133]: use of inline assembly is unsafe and requires unsafe function or block + --> $DIR/inline_asm.rs:6: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/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.mir.stderr b/tests/ui/unsafe/issue-3080.mir.stderr deleted file mode 100644 index a1ad98d205e..00000000000 --- a/tests/ui/unsafe/issue-3080.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-3080.rs:10:5 - | -LL | X(()).with(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 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.stderr b/tests/ui/unsafe/issue-3080.stderr new file mode 100644 index 00000000000..f84ba204639 --- /dev/null +++ b/tests/ui/unsafe/issue-3080.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-3080.rs:7: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-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.mir.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr deleted file mode 100644 index e7960960774..00000000000 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.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-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.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr new file mode 100644 index 00000000000..cc1e73bb932 --- /dev/null +++ b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr @@ -0,0 +1,27 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-45087-unreachable-unsafe.rs:5: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:15: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:27: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-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.mir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.stderr deleted file mode 100644 index 9e9cbcf33ae..00000000000 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.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 | |w: &mut Vec| { 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| { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 3 previous errors - 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::::with_capacity(24); diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr new file mode 100644 index 00000000000..321698e7636 --- /dev/null +++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -0,0 +1,35 @@ +error: unnecessary `unsafe` block + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:7: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:1:8 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:9:38 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | |w: &mut Vec| { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:13:34 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | |x: &mut Vec| { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 3 previous errors + 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| { 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| { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 3 previous errors - diff --git a/tests/ui/unsafe/issue-47412.mir.stderr b/tests/ui/unsafe/issue-47412.mir.stderr deleted file mode 100644 index 305f482e8c2..00000000000 --- a/tests/ui/unsafe/issue-47412.mir.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-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.stderr b/tests/ui/unsafe/issue-47412.stderr new file mode 100644 index 00000000000..aebcbf07463 --- /dev/null +++ b/tests/ui/unsafe/issue-47412.stderr @@ -0,0 +1,19 @@ +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/issue-47412.rs:11: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:17: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-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() -> Box> { todo!() } diff --git a/tests/ui/unsafe/ranged_ints.mir.stderr b/tests/ui/unsafe/ranged_ints.mir.stderr deleted file mode 100644 index ef00edae05d..00000000000 --- a/tests/ui/unsafe/ranged_ints.mir.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_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.stderr b/tests/ui/unsafe/ranged_ints.stderr new file mode 100644 index 00000000000..b6875e15815 --- /dev/null +++ b/tests/ui/unsafe/ranged_ints.stderr @@ -0,0 +1,11 @@ +error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block + --> $DIR/ranged_ints.rs:7: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_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.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr deleted file mode 100644 index dc6bd72f56c..00000000000 --- a/tests/ui/unsafe/ranged_ints2.mirunsafeck.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.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.stderr b/tests/ui/unsafe/ranged_ints2.stderr new file mode 100644 index 00000000000..1885e77af7e --- /dev/null +++ b/tests/ui/unsafe/ranged_ints2.stderr @@ -0,0 +1,19 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints2.rs:8: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:9: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.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.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr deleted file mode 100644 index c16550a5800..00000000000 --- a/tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr +++ /dev/null @@ -1,39 +0,0 @@ -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 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 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 for more information - = 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 - | -LL | let y = &mut x.0; - | ^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -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_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.stderr b/tests/ui/unsafe/ranged_ints2_const.stderr new file mode 100644 index 00000000000..a0dc950e76d --- /dev/null +++ b/tests/ui/unsafe/ranged_ints2_const.stderr @@ -0,0 +1,39 @@ +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/ranged_ints2_const.rs:11:13 + | +LL | let y = &mut x.0; + | ^^^^^^^^ + | + = note: see issue #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:18:22 + | +LL | let y = unsafe { &mut x.0 }; + | ^^^^^^^^ + | + = note: see issue #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:24:22 + | +LL | unsafe { let y = &mut x.0; } + | ^^^^^^^^ + | + = note: see issue #57349 for more information + = 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: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: 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_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 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 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 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.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr deleted file mode 100644 index 72bce5de0ae..00000000000 --- a/tests/ui/unsafe/ranged_ints3.mirunsafeck.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.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.stderr b/tests/ui/unsafe/ranged_ints3.stderr new file mode 100644 index 00000000000..8dcb99fc16d --- /dev/null +++ b/tests/ui/unsafe/ranged_ints3.stderr @@ -0,0 +1,11 @@ +error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block + --> $DIR/ranged_ints3.rs:10: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.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.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr deleted file mode 100644 index 62df9333069..00000000000 --- a/tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr +++ /dev/null @@ -1,30 +0,0 @@ -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 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 for more information - = 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 - | -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 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_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.stderr b/tests/ui/unsafe/ranged_ints3_const.stderr new file mode 100644 index 00000000000..215005571f6 --- /dev/null +++ b/tests/ui/unsafe/ranged_ints3_const.stderr @@ -0,0 +1,30 @@ +error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability + --> $DIR/ranged_ints3_const.rs:12:13 + | +LL | let y = &x.0; + | ^^^^ + | + = note: see issue #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:19:22 + | +LL | let y = unsafe { &x.0 }; + | ^^^^ + | + = note: see issue #80384 for more information + = 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:12: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 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_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 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 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.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr deleted file mode 100644 index 27c06640928..00000000000 --- a/tests/ui/unsafe/ranged_ints3_match.mirunsafeck.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_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.stderr b/tests/ui/unsafe/ranged_ints3_match.stderr new file mode 100644 index 00000000000..1bdc29d077c --- /dev/null +++ b/tests/ui/unsafe/ranged_ints3_match.stderr @@ -0,0 +1,19 @@ +error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block + --> $DIR/ranged_ints3_match.rs:11: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:17: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_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.stderr b/tests/ui/unsafe/ranged_ints4.stderr new file mode 100644 index 00000000000..4a703696b88 --- /dev/null +++ b/tests/ui/unsafe/ranged_ints4.stderr @@ -0,0 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints4.rs:8: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.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr deleted file mode 100644 index 4f2f1e42e76..00000000000 --- a/tests/ui/unsafe/ranged_ints4.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.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_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr deleted file mode 100644 index a2a3ae668a2..00000000000 --- a/tests/ui/unsafe/ranged_ints4_const.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_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_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.stderr b/tests/ui/unsafe/ranged_ints4_const.stderr new file mode 100644 index 00000000000..604ec1167e4 --- /dev/null +++ b/tests/ui/unsafe/ranged_ints4_const.stderr @@ -0,0 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints4_const.rs:10: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_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.mir.stderr b/tests/ui/unsafe/ranged_ints_const.mir.stderr deleted file mode 100644 index 563b9be2672..00000000000 --- a/tests/ui/unsafe/ranged_ints_const.mir.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 { 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_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.stderr b/tests/ui/unsafe/ranged_ints_const.stderr new file mode 100644 index 00000000000..2b8be290d3a --- /dev/null +++ b/tests/ui/unsafe/ranged_ints_const.stderr @@ -0,0 +1,11 @@ +error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block + --> $DIR/ranged_ints_const.rs:8:34 + | +LL | const fn foo() -> NonZero { 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_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 { 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.mir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr deleted file mode 100644 index 0c0826c1cfb..00000000000 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr +++ /dev/null @@ -1,112 +0,0 @@ -error: call to unsafe function 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 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 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 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/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.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr new file mode 100644 index 00000000000..d61d87cd001 --- /dev/null +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr @@ -0,0 +1,112 @@ +error: call to unsafe function is unsafe and requires unsafe block (error E0133) + --> $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:8:1 + | +LL | unsafe fn deny_level() { + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $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:11: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:13: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:16:5 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $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: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:23:1 + | +LL | unsafe fn warning_level() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $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:26: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:28: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:30:5 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $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:71: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 is unsafe and requires unsafe function or block + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:75: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/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.mirunsafeck.stderr b/tests/ui/unsafe/union-assignop.mirunsafeck.stderr deleted file mode 100644 index 0ecd5203dd9..00000000000 --- a/tests/ui/unsafe/union-assignop.mirunsafeck.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-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.stderr b/tests/ui/unsafe/union-assignop.stderr new file mode 100644 index 00000000000..e3a673ee1ff --- /dev/null +++ b/tests/ui/unsafe/union-assignop.stderr @@ -0,0 +1,51 @@ +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/union-assignop.rs:16: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:17: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:18: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:20: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:22: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:24: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-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.mir.stderr b/tests/ui/unsafe/union.mir.stderr deleted file mode 100644 index 787714cdd2d..00000000000 --- a/tests/ui/unsafe/union.mir.stderr +++ /dev/null @@ -1,19 +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:32:11 - | -LL | match foo { - | ^^^ 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/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.stderr b/tests/ui/unsafe/union.stderr new file mode 100644 index 00000000000..fe814462412 --- /dev/null +++ b/tests/ui/unsafe/union.stderr @@ -0,0 +1,19 @@ +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/union.rs:27: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:29:11 + | +LL | match foo { + | ^^^ 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/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.mir.stderr b/tests/ui/unsafe/union_destructure.mir.stderr deleted file mode 100644 index 818f5ce03b5..00000000000 --- a/tests/ui/unsafe/union_destructure.mir.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:35:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: `#[warn(unused_unsafe)]` on by default - -warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:41:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -warning: 2 warnings emitted - 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.stderr b/tests/ui/unsafe/union_destructure.stderr new file mode 100644 index 00000000000..431521472e8 --- /dev/null +++ b/tests/ui/unsafe/union_destructure.stderr @@ -0,0 +1,16 @@ +warning: unnecessary `unsafe` block + --> $DIR/union_destructure.rs:33:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: `#[warn(unused_unsafe)]` on by default + +warning: unnecessary `unsafe` block + --> $DIR/union_destructure.rs:39:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +warning: 2 warnings emitted + 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.mir.stderr b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr deleted file mode 100644 index 62199e5a2ec..00000000000 --- a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.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-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.stderr b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr new file mode 100644 index 00000000000..ffadd90c64b --- /dev/null +++ b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -0,0 +1,20 @@ +error: unnecessary `unsafe` block + --> $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:3:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:11:5 + | +LL | unsafe { println!("foo"); } + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 2 previous errors + 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.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr deleted file mode 100644 index f8b55e0668d..00000000000 --- a/tests/ui/unsafe/unsafe-assign.mirunsafeck.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-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.stderr b/tests/ui/unsafe/unsafe-assign.stderr new file mode 100644 index 00000000000..1fa5d715c2e --- /dev/null +++ b/tests/ui/unsafe/unsafe-assign.stderr @@ -0,0 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/unsafe-assign.rs:9: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-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.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr deleted file mode 100644 index a206722495a..00000000000 --- a/tests/ui/unsafe/unsafe-borrow.mirunsafeck.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-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.stderr b/tests/ui/unsafe/unsafe-borrow.stderr new file mode 100644 index 00000000000..a53b50583ca --- /dev/null +++ b/tests/ui/unsafe/unsafe-borrow.stderr @@ -0,0 +1,27 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/unsafe-borrow.rs:9: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:29: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:48: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-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.mir.stderr b/tests/ui/unsafe/unsafe-const-fn.mir.stderr deleted file mode 100644 index 2450f08664c..00000000000 --- a/tests/ui/unsafe/unsafe-const-fn.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-const-fn.rs:10:18 - | -LL | const VAL: u32 = dummy(0xFFFF); - | ^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -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.stderr b/tests/ui/unsafe/unsafe-const-fn.stderr new file mode 100644 index 00000000000..8d7f09a1edb --- /dev/null +++ b/tests/ui/unsafe/unsafe-const-fn.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-const-fn.rs:7: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-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.mir.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr deleted file mode 100644 index da3d5f3bd29..00000000000 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.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-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.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr new file mode 100644 index 00000000000..d79cbd466c2 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -0,0 +1,11 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-assign-deref-ptr.rs:2: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-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.mir.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr deleted file mode 100644 index d3347437075..00000000000 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-called-from-safe.rs:7:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 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.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr new file mode 100644 index 00000000000..51aba0ba6d7 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-called-from-safe.rs:4: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-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.mir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr deleted file mode 100644 index 7f1e7c8902f..00000000000 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.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-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.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.stderr new file mode 100644 index 00000000000..2e68963097e --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.stderr @@ -0,0 +1,35 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-deref-ptr.rs:2: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:3: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:4: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:5: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-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.mir.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr deleted file mode 100644 index 01e8e49ecfa..00000000000 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-used-as-value.rs:8:5 - | -LL | x(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -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.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.stderr new file mode 100644 index 00000000000..1625de184d2 --- /dev/null +++ b/tests/ui/unsafe/unsafe-fn-used-as-value.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-used-as-value.rs:5: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-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.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr deleted file mode 100644 index 5536efbc6f4..00000000000 --- a/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.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 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-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.stderr b/tests/ui/unsafe/unsafe-not-inherited.stderr new file mode 100644 index 00000000000..3bc5ca5c9d1 --- /dev/null +++ b/tests/ui/unsafe/unsafe-not-inherited.stderr @@ -0,0 +1,24 @@ +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/unsafe-not-inherited.rs:6: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 is unsafe and requires unsafe function or block + --> $DIR/unsafe-not-inherited.rs:18: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-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.mir.stderr b/tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr deleted file mode 100644 index 79133ab39a0..00000000000 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.mir.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/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.stderr b/tests/ui/unsafe/unsafe-unstable-const-fn.stderr new file mode 100644 index 00000000000..22a2dcbf119 --- /dev/null +++ b/tests/ui/unsafe/unsafe-unstable-const-fn.stderr @@ -0,0 +1,11 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/unsafe-unstable-const-fn.rs:7: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/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.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed new file mode 100644 index 00000000000..f776cffed59 --- /dev/null +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed @@ -0,0 +1,67 @@ +// run-rustfix +// aux-build:external_unsafe_macro.rs + +#![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(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE + //~| NOTE + unsf(); //~ ERROR call to unsafe function 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()) } +//~^ ERROR call to unsafe function is unsafe +//~| NOTE +//~| NOTE +//~| ERROR call to unsafe function 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.mir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed deleted file mode 100644 index b59029df642..00000000000 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.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.mir.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr deleted file mode 100644 index 7a1b83c7367..00000000000 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr +++ /dev/null @@ -1,99 +0,0 @@ -error: call to unsafe function 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 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 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 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 - 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.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr new file mode 100644 index 00000000000..9ae238d5a79 --- /dev/null +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr @@ -0,0 +1,99 @@ +error: call to unsafe function is unsafe and requires unsafe block (error E0133) + --> $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:11:1 + | +LL | pub unsafe fn foo() { + | ^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $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:16: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: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: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:26: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: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: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:37: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 is unsafe and requires unsafe block (error E0133) + --> $DIR/wrapping-unsafe-block-sugg.rs:42: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: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:42: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 + 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 - -- cgit 1.4.1-3-g733a5 From 26f48b4cba17a6f7d321bccaa86b345596923763 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 7 Dec 2023 11:56:48 +0000 Subject: Stabilize THIR unsafeck --- compiler/rustc_interface/src/passes.rs | 6 +- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_middle/src/mir/mod.rs | 4 +- compiler/rustc_middle/src/query/mod.rs | 9 +- compiler/rustc_mir_build/src/check_unsafety.rs | 9 +- compiler/rustc_mir_build/src/lib.rs | 2 +- compiler/rustc_mir_transform/src/check_unsafety.rs | 11 +- compiler/rustc_mir_transform/src/lib.rs | 4 +- compiler/rustc_session/src/options.rs | 4 +- src/tools/tidy/src/ui_tests.rs | 2 +- .../ui/async-await/async-unsafe-fn-call-in-safe.rs | 8 +- .../async-unsafe-fn-call-in-safe.stderr | 8 +- tests/ui/binding/issue-53114-safety-checks.stderr | 144 ++++++++++----------- .../coerce-unsafe-closure-to-unsafe-fn-ptr.stderr | 2 +- .../const-extern-fn-requires-unsafe.rs | 8 +- .../const-extern-fn-requires-unsafe.stderr | 8 +- tests/ui/consts/issue-16538.stderr | 18 +-- .../issue-45729-unsafe-in-coroutine.stderr | 2 +- tests/ui/error-codes/E0133.stderr | 2 +- tests/ui/extern/issue-28324.stderr | 4 +- tests/ui/inline-const/expr-unsafe-err.stderr | 2 +- tests/ui/intrinsics/unchecked_math_unsafe.stderr | 6 +- tests/ui/issues/issue-28776.stderr | 2 +- tests/ui/issues/issue-5844.stderr | 2 +- tests/ui/lifetimes/issue-76168-hr-outlives-3.rs | 5 +- .../ui/lifetimes/issue-76168-hr-outlives-3.stderr | 25 +--- tests/ui/pattern/usefulness/issue-57472.rs | 12 +- tests/ui/pattern/usefulness/issue-57472.stderr | 6 +- .../rfcs/rfc-2396-target_feature-11/safe-calls.rs | 24 ++-- .../rfc-2396-target_feature-11/safe-calls.stderr | 24 ++-- tests/ui/static/safe-extern-statics-mut.stderr | 8 +- tests/ui/static/safe-extern-statics.stderr | 8 +- .../static-mut-foreign-requires-unsafe.stderr | 4 +- tests/ui/static/static-mut-requires-unsafe.stderr | 4 +- tests/ui/thread-local/thread-local-static.stderr | 16 +-- tests/ui/threads-sendsync/issue-43733.rs | 4 +- tests/ui/threads-sendsync/issue-43733.stderr | 4 +- tests/ui/traits/safety-fn-body.stderr | 2 +- .../self-in-enum-definition.stderr | 5 - tests/ui/union/union-unsafe.stderr | 12 +- tests/ui/union/union-unsized.stderr | 14 +- .../unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs | 2 +- .../edition-2024-unsafe_op_in_unsafe_fn.stderr | 2 +- tests/ui/unsafe/foreign-unsafe-fn-called.rs | 2 +- tests/ui/unsafe/foreign-unsafe-fn-called.stderr | 2 +- tests/ui/unsafe/issue-3080.stderr | 2 +- .../unsafe/issue-45087-unreachable-unsafe.stderr | 6 +- ...ssue-45107-unnecessary-unsafe-in-closure.stderr | 6 +- tests/ui/unsafe/ranged_ints2_const.stderr | 16 +-- tests/ui/unsafe/ranged_ints3_const.stderr | 16 +-- tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs | 8 +- .../unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr | 12 +- tests/ui/unsafe/union-assignop.stderr | 2 +- tests/ui/unsafe/union.rs | 9 +- tests/ui/unsafe/union.stderr | 27 +++- tests/ui/unsafe/union_destructure.rs | 12 +- tests/ui/unsafe/union_destructure.stderr | 16 --- tests/ui/unsafe/unsafe-const-fn.stderr | 2 +- tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr | 2 +- tests/ui/unsafe/unsafe-fn-called-from-safe.rs | 6 +- tests/ui/unsafe/unsafe-fn-called-from-safe.stderr | 4 +- tests/ui/unsafe/unsafe-fn-used-as-value.rs | 6 +- tests/ui/unsafe/unsafe-fn-used-as-value.stderr | 4 +- tests/ui/unsafe/unsafe-not-inherited.stderr | 2 +- tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed | 8 +- tests/ui/unsafe/wrapping-unsafe-block-sugg.rs | 8 +- tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr | 8 +- 67 files changed, 307 insertions(+), 329 deletions(-) delete mode 100644 tests/ui/unsafe/union_destructure.stderr diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 559874641c3..ce76c2cba93 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -735,9 +735,9 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { sess.time("MIR_borrow_checking", || { tcx.hir().par_body_owners(|def_id| { - // Run THIR unsafety check because it's responsible for stealing - // and deallocating THIR when enabled. - tcx.ensure().thir_check_unsafety(def_id); + // Run unsafety check because it's responsible for stealing and + // deallocating THIR. + tcx.ensure().check_unsafety(def_id); tcx.ensure().mir_borrowck(def_id) }); }); diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index c4a1f3a0e51..75410db1e36 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -822,7 +822,7 @@ fn test_unstable_options_tracking_hash() { tracked!(stack_protector, StackProtector::All); tracked!(teach, true); tracked!(thinlto, Some(true)); - tracked!(thir_unsafeck, true); + tracked!(thir_unsafeck, false); tracked!(tiny_const_eval_limit, true); tracked!(tls_model, Some(TlsModel::GeneralDynamic)); tracked!(translate_remapped_path_to_local_path, false); diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 5c425fef27e..0a1a72b442a 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -720,7 +720,7 @@ pub struct SourceInfo { pub span: Span, /// The source scope, keeping track of which bindings can be - /// seen by debuginfo, active lint levels, `unsafe {...}`, etc. + /// seen by debuginfo, active lint levels, etc. pub scope: SourceScope, } @@ -942,7 +942,7 @@ pub struct LocalDecl<'tcx> { /// Extra information about a some locals that's used for diagnostics and for /// classifying variables into local variables, statics, etc, which is needed e.g. -/// for unsafety checking. +/// for borrow checking. /// /// Not used for non-StaticRef temporaries, the return place, or anonymous /// function parameters. diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 2810182c0a0..bf5e59ba78d 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -869,15 +869,14 @@ rustc_queries! { desc { |tcx| "collecting all inherent impls for `{:?}`", key } } - /// The result of unsafety-checking this `LocalDefId`. - query unsafety_check_result(key: LocalDefId) -> &'tcx mir::UnsafetyCheckResult { + /// The result of unsafety-checking this `LocalDefId` with the old checker. + query mir_unsafety_check_result(key: LocalDefId) -> &'tcx mir::UnsafetyCheckResult { desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) } cache_on_disk_if { true } } - /// Unsafety-check this `LocalDefId` with THIR unsafeck. This should be - /// used with `-Zthir-unsafeck`. - query thir_check_unsafety(key: LocalDefId) { + /// Unsafety-check this `LocalDefId`. + query check_unsafety(key: LocalDefId) { desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) } cache_on_disk_if { true } } diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 2e8b6c19ec7..7d0ce53997a 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -14,7 +14,7 @@ use rustc_session::lint::builtin::{UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE}; use rustc_session::lint::Level; use rustc_span::def_id::{DefId, LocalDefId}; use rustc_span::symbol::Symbol; -use rustc_span::Span; +use rustc_span::{sym, Span}; use std::mem; use std::ops::Bound; @@ -886,14 +886,15 @@ impl UnsafeOpKind { } } -pub fn thir_check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) { - // THIR unsafeck is gated under `-Z thir-unsafeck` +pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) { + // THIR unsafeck can be disabled with `-Z thir-unsafeck=off` if !tcx.sess.opts.unstable_opts.thir_unsafeck { return; } // Closures and inline consts are handled by their owner, if it has a body - if tcx.is_typeck_child(def.to_def_id()) { + // Also, don't safety check custom MIR + if tcx.is_typeck_child(def.to_def_id()) || tcx.has_attr(def, sym::custom_mir) { return; } diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index a776e917de5..430c4ee3da7 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -31,7 +31,7 @@ pub fn provide(providers: &mut Providers) { providers.mir_built = build::mir_built; providers.closure_saved_names_of_captured_variables = build::closure_saved_names_of_captured_variables; - providers.thir_check_unsafety = check_unsafety::thir_check_unsafety; + providers.check_unsafety = check_unsafety::check_unsafety; providers.thir_body = thir::cx::thir_body; providers.thir_tree = thir::print::thir_tree; providers.thir_flat = thir::print::thir_flat; diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs index d94d96c1115..582c2c0c6b6 100644 --- a/compiler/rustc_mir_transform/src/check_unsafety.rs +++ b/compiler/rustc_mir_transform/src/check_unsafety.rs @@ -131,7 +131,7 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> { &AggregateKind::Closure(def_id, _) | &AggregateKind::Coroutine(def_id, _) => { let def_id = def_id.expect_local(); let UnsafetyCheckResult { violations, used_unsafe_blocks, .. } = - self.tcx.unsafety_check_result(def_id); + self.tcx.mir_unsafety_check_result(def_id); self.register_violations(violations, used_unsafe_blocks.items().copied()); } }, @@ -153,7 +153,7 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> { if self.tcx.def_kind(def_id) == DefKind::InlineConst { let local_def_id = def_id.expect_local(); let UnsafetyCheckResult { violations, used_unsafe_blocks, .. } = - self.tcx.unsafety_check_result(local_def_id); + self.tcx.mir_unsafety_check_result(local_def_id); self.register_violations(violations, used_unsafe_blocks.items().copied()); } } @@ -390,7 +390,7 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> { } pub(crate) fn provide(providers: &mut Providers) { - *providers = Providers { unsafety_check_result, ..*providers }; + *providers = Providers { mir_unsafety_check_result, ..*providers }; } /// Context information for [`UnusedUnsafeVisitor`] traversal, @@ -490,7 +490,7 @@ fn check_unused_unsafe( unused_unsafes } -fn unsafety_check_result(tcx: TyCtxt<'_>, def: LocalDefId) -> &UnsafetyCheckResult { +fn mir_unsafety_check_result(tcx: TyCtxt<'_>, def: LocalDefId) -> &UnsafetyCheckResult { debug!("unsafety_violations({:?})", def); // N.B., this borrow is valid because all the consumers of @@ -538,7 +538,8 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) { return; } - let UnsafetyCheckResult { violations, unused_unsafes, .. } = tcx.unsafety_check_result(def_id); + let UnsafetyCheckResult { violations, unused_unsafes, .. } = + tcx.mir_unsafety_check_result(def_id); // Only suggest wrapping the entire function body in an unsafe block once let mut suggest_unsafe_block = true; diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 5562ae7f3bd..164b6b9c4f5 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -285,9 +285,9 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs { /// FIXME(oli-obk): it's unclear whether we still need this phase (and its corresponding query). /// We used to have this for pre-miri MIR based const eval. fn mir_const(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal> { - // Unsafety check uses the raw mir, so make sure it is run. + // MIR unsafety check uses the raw mir, so make sure it is run. if !tcx.sess.opts.unstable_opts.thir_unsafeck { - tcx.ensure_with_value().unsafety_check_result(def); + tcx.ensure_with_value().mir_unsafety_check_result(def); } // has_ffi_unwind_calls query uses the raw mir, so make sure it is run. diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 8274fd05bc0..0b0b67ef890 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1919,8 +1919,8 @@ written to standard error output)"), #[rustc_lint_opt_deny_field_access("use `Session::lto` instead of this field")] thinlto: Option = (None, parse_opt_bool, [TRACKED], "enable ThinLTO when possible"), - thir_unsafeck: bool = (false, parse_bool, [TRACKED], - "use the THIR unsafety checker (default: no)"), + thir_unsafeck: bool = (true, parse_bool, [TRACKED], + "use the THIR unsafety checker (default: yes)"), /// We default to 1 here since we want to behave like /// a sequential compiler for now. This'll likely be adjusted /// in the future. Note that -Zthreads=0 is the way to get diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index dfa386b49de..b4745d4883c 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -10,7 +10,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: usize = 1852; +const ISSUES_ENTRY_LIMIT: usize = 1849; const ROOT_ENTRY_LIMIT: usize = 867; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs index f7e9e96bff7..7695853000d 100644 --- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs +++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs @@ -10,14 +10,14 @@ async unsafe fn f() {} async fn g() { S::f(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `S::f` is unsafe f(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `f` is unsafe } fn main() { S::f(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `S::f` is unsafe f(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `f` is unsafe } diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr index 89c496c598d..b25794c0892 100644 --- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr +++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block --> $DIR/async-unsafe-fn-call-in-safe.rs:12:5 | LL | S::f(); @@ -6,7 +6,7 @@ LL | S::f(); | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | LL | f(); @@ -14,7 +14,7 @@ LL | f(); | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 | LL | S::f(); @@ -22,7 +22,7 @@ LL | S::f(); | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block --> $DIR/async-unsafe-fn-call-in-safe.rs:21:5 | LL | f(); diff --git a/tests/ui/binding/issue-53114-safety-checks.stderr b/tests/ui/binding/issue-53114-safety-checks.stderr index 349c4639a9e..b7d805d9171 100644 --- a/tests/ui/binding/issue-53114-safety-checks.stderr +++ b/tests/ui/binding/issue-53114-safety-checks.stderr @@ -1,63 +1,3 @@ -error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:23:13 - | -LL | let _ = &p.b; - | ^^^^ - | - = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses - = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - -error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:28:17 - | -LL | let (_,) = (&p.b,); - | ^^^^ - | - = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses - = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - -error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:37:16 - | -LL | let _: _ = &p.b; - | ^^^^ - | - = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses - = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - -error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:42:20 - | -LL | let (_,): _ = (&p.b,); - | ^^^^ - | - = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses - = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - -error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:51:11 - | -LL | match &p.b { _ => { } } - | ^^^^ - | - = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses - = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - -error[E0793]: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:56:12 - | -LL | match (&p.b,) { (_,) => { } } - | ^^^^ - | - = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses - = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/issue-53114-safety-checks.rs:24:13 | @@ -67,10 +7,10 @@ LL | let _ = u1.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/issue-53114-safety-checks.rs:25:13 + --> $DIR/issue-53114-safety-checks.rs:25:14 | LL | let _ = &u2.a; - | ^^^^^ access to union field + | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -83,13 +23,33 @@ LL | let (_,) = (u1.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/issue-53114-safety-checks.rs:30:17 + --> $DIR/issue-53114-safety-checks.rs:30:18 | LL | let (_,) = (&u2.a,); - | ^^^^^ access to union field + | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:23:13 + | +LL | let _ = &p.b; + | ^^^^ + | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:28:17 + | +LL | let (_,) = (&p.b,); + | ^^^^ + | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/issue-53114-safety-checks.rs:38:16 | @@ -99,10 +59,10 @@ LL | let _: _ = u1.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/issue-53114-safety-checks.rs:39:16 + --> $DIR/issue-53114-safety-checks.rs:39:17 | LL | let _: _ = &u2.a; - | ^^^^^ access to union field + | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -115,13 +75,33 @@ LL | let (_,): _ = (u1.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/issue-53114-safety-checks.rs:44:20 + --> $DIR/issue-53114-safety-checks.rs:44:21 | LL | let (_,): _ = (&u2.a,); - | ^^^^^ access to union field + | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:37:16 + | +LL | let _: _ = &p.b; + | ^^^^ + | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:42:20 + | +LL | let (_,): _ = (&p.b,); + | ^^^^ + | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/issue-53114-safety-checks.rs:52:11 | @@ -131,10 +111,10 @@ LL | match u1.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/issue-53114-safety-checks.rs:53:11 + --> $DIR/issue-53114-safety-checks.rs:53:12 | LL | match &u2.a { _ => { } } - | ^^^^^ access to union field + | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -147,13 +127,33 @@ LL | match (u1.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/issue-53114-safety-checks.rs:58:12 + --> $DIR/issue-53114-safety-checks.rs:58:13 | LL | match (&u2.a,) { (_,) => { } } - | ^^^^^ access to union field + | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:51:11 + | +LL | match &p.b { _ => { } } + | ^^^^ + | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:56:12 + | +LL | match (&p.b,) { (_,) => { } } + | ^^^^ + | + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + error: aborting due to 18 previous errors Some errors have detailed explanations: E0133, E0793. diff --git a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr index 75c379c88e3..f5cb3e2b5f8 100644 --- a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr +++ b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `Pin::

::new_unchecked` is unsafe and requires unsafe function or block --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31 | LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs index 896d4b376fd..95fb9ef4260 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -1,10 +1,12 @@ #![feature(const_extern_fn)] -const unsafe extern "C" fn foo() -> usize { 5 } +const unsafe extern "C" fn foo() -> usize { + 5 +} fn main() { let a: [u8; foo()]; - //~^ call to unsafe function is unsafe and requires unsafe function or block + //~^ call to unsafe function `foo` is unsafe and requires unsafe function or block foo(); - //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block } diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr index 5196b8ee0a2..6f59b2f2055 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr @@ -1,13 +1,13 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:8:5 +error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block + --> $DIR/const-extern-fn-requires-unsafe.rs:10:5 | LL | foo(); | ^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:6:17 +error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block + --> $DIR/const-extern-fn-requires-unsafe.rs:8:17 | LL | let a: [u8; foo()]; | ^^^^^ call to unsafe function diff --git a/tests/ui/consts/issue-16538.stderr b/tests/ui/consts/issue-16538.stderr index afb344f5e85..834ffa8d3a0 100644 --- a/tests/ui/consts/issue-16538.stderr +++ b/tests/ui/consts/issue-16538.stderr @@ -1,11 +1,10 @@ -error[E0015]: cannot call non-const fn `Y::foo` in statics - --> $DIR/issue-16538.rs:11:23 +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:11:22 | LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer | - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + = 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]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-16538.rs:11:30 @@ -15,13 +14,14 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-16538.rs:11:21 +error[E0015]: cannot call non-const fn `Y::foo` in statics + --> $DIR/issue-16538.rs:11:23 | LL | static foo: &Y::X = &*Y::foo(Y::x as *const 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: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to 3 previous errors diff --git a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr index d0f200b8360..19949b42939 100644 --- a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr +++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr @@ -2,7 +2,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function --> $DIR/issue-45729-unsafe-in-coroutine.rs:5:9 | LL | *(1 as *mut u32) = 42; - | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | ^^^^^^^^^^^^^^^^ 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 diff --git a/tests/ui/error-codes/E0133.stderr b/tests/ui/error-codes/E0133.stderr index a1ae6cb7fc9..5e3e49fb644 100644 --- a/tests/ui/error-codes/E0133.stderr +++ b/tests/ui/error-codes/E0133.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block --> $DIR/E0133.rs:4:5 | LL | f(); diff --git a/tests/ui/extern/issue-28324.stderr b/tests/ui/extern/issue-28324.stderr index be748b47d4d..94ff2131993 100644 --- a/tests/ui/extern/issue-28324.stderr +++ b/tests/ui/extern/issue-28324.stderr @@ -1,8 +1,8 @@ error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28324.rs:5:24 + --> $DIR/issue-28324.rs:5:25 | LL | pub static BAZ: u32 = *&error_message_count; - | ^^^^^^^^^^^^^^^^^^^^ use of extern static + | ^^^^^^^^^^^^^^^^^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior diff --git a/tests/ui/inline-const/expr-unsafe-err.stderr b/tests/ui/inline-const/expr-unsafe-err.stderr index ebd18f89d9c..45f850d1f99 100644 --- a/tests/ui/inline-const/expr-unsafe-err.stderr +++ b/tests/ui/inline-const/expr-unsafe-err.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block --> $DIR/expr-unsafe-err.rs:8:9 | LL | require_unsafe(); diff --git a/tests/ui/intrinsics/unchecked_math_unsafe.stderr b/tests/ui/intrinsics/unchecked_math_unsafe.stderr index 4066cf8efb8..31da1a86ca1 100644 --- a/tests/ui/intrinsics/unchecked_math_unsafe.stderr +++ b/tests/ui/intrinsics/unchecked_math_unsafe.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `unchecked_add` is unsafe and requires unsafe function or block --> $DIR/unchecked_math_unsafe.rs:5:15 | LL | let add = std::intrinsics::unchecked_add(x, y); @@ -6,7 +6,7 @@ LL | let add = std::intrinsics::unchecked_add(x, y); | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `unchecked_sub` is unsafe and requires unsafe function or block --> $DIR/unchecked_math_unsafe.rs:6:15 | LL | let sub = std::intrinsics::unchecked_sub(x, y); @@ -14,7 +14,7 @@ LL | let sub = std::intrinsics::unchecked_sub(x, y); | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `unchecked_mul` is unsafe and requires unsafe function or block --> $DIR/unchecked_math_unsafe.rs:7:15 | LL | let mul = std::intrinsics::unchecked_mul(x, y); diff --git a/tests/ui/issues/issue-28776.stderr b/tests/ui/issues/issue-28776.stderr index 9f0f10335ab..3db94ee1810 100644 --- a/tests/ui/issues/issue-28776.stderr +++ b/tests/ui/issues/issue-28776.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `std::ptr::write` is unsafe and requires unsafe function or block --> $DIR/issue-28776.rs:4:5 | LL | (&ptr::write)(1 as *mut _, 42); diff --git a/tests/ui/issues/issue-5844.stderr b/tests/ui/issues/issue-5844.stderr index af7bfb03320..bae917fa72c 100644 --- a/tests/ui/issues/issue-5844.stderr +++ b/tests/ui/issues/issue-5844.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block --> $DIR/issue-5844.rs:6:5 | LL | issue_5844_aux::rand(); diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs index b0b6b318d8f..782c38200a0 100644 --- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs +++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs @@ -6,10 +6,9 @@ use std::future::Future; async fn wrapper(f: F) //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` //~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` -//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` where - F:, - for<'a> >::Output: Future + 'a, +F:, +for<'a> >::Output: Future + 'a, { //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` let mut i = 41; diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr index 5b77051dc88..89ebdb57f3c 100644 --- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr +++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr @@ -4,11 +4,10 @@ error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` LL | / async fn wrapper(f: F) LL | | LL | | -LL | | LL | | where -LL | | F:, -LL | | for<'a> >::Output: Future + 'a, - | |______________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` +LL | | F:, +LL | | for<'a> >::Output: Future + 'a, + | |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` @@ -21,7 +20,7 @@ LL | async fn wrapper(f: F) = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` - --> $DIR/issue-76168-hr-outlives-3.rs:13:1 + --> $DIR/issue-76168-hr-outlives-3.rs:12:1 | LL | / { LL | | @@ -32,20 +31,6 @@ LL | | } | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` -error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` - --> $DIR/issue-76168-hr-outlives-3.rs:6:1 - | -LL | / async fn wrapper(f: F) -LL | | -LL | | -LL | | -LL | | where -LL | | F:, -LL | | for<'a> >::Output: Future + 'a, - | |______________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` - | - = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/pattern/usefulness/issue-57472.rs b/tests/ui/pattern/usefulness/issue-57472.rs index 1131006374c..17c252de2be 100644 --- a/tests/ui/pattern/usefulness/issue-57472.rs +++ b/tests/ui/pattern/usefulness/issue-57472.rs @@ -1,4 +1,4 @@ -#![crate_type="lib"] +#![crate_type = "lib"] #![deny(unreachable_patterns)] mod test_struct { @@ -26,10 +26,12 @@ mod test_union { } pub fn test(punned: Punned) { - match punned { - Punned { foo: [_] } => println!("foo"), - Punned { bar: [_] } => println!("bar"), - //~^ ERROR unreachable pattern [unreachable_patterns] + unsafe { + match punned { + Punned { foo: [_] } => println!("foo"), + Punned { bar: [_] } => println!("bar"), + //~^ ERROR unreachable pattern [unreachable_patterns] + } } } } diff --git a/tests/ui/pattern/usefulness/issue-57472.stderr b/tests/ui/pattern/usefulness/issue-57472.stderr index 26efdf6dbaf..c814eaec0d1 100644 --- a/tests/ui/pattern/usefulness/issue-57472.stderr +++ b/tests/ui/pattern/usefulness/issue-57472.stderr @@ -11,10 +11,10 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/issue-57472.rs:31:13 + --> $DIR/issue-57472.rs:32:17 | -LL | Punned { bar: [_] } => println!("bar"), - | ^^^^^^^^^^^^^^^^^^^ +LL | Punned { bar: [_] } => println!("bar"), + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs index b420d14d1e1..788c79adc1f 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs @@ -23,50 +23,50 @@ impl Quux { fn foo() { sse2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `sse2` with `#[target_feature]` is unsafe avx_bmi2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe Quux.avx_bmi2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe } #[target_feature(enable = "sse2")] fn bar() { avx_bmi2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe Quux.avx_bmi2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe } #[target_feature(enable = "avx")] fn baz() { sse2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `sse2` with `#[target_feature]` is unsafe avx_bmi2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe Quux.avx_bmi2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe } #[target_feature(enable = "avx")] #[target_feature(enable = "bmi2")] fn qux() { sse2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `sse2` with `#[target_feature]` is unsafe } const _: () = sse2(); -//~^ ERROR call to function with `#[target_feature]` is unsafe +//~^ ERROR call to function `sse2` with `#[target_feature]` is unsafe const _: () = sse2_and_fxsr(); -//~^ ERROR call to function with `#[target_feature]` is unsafe +//~^ ERROR call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe #[deny(unsafe_op_in_unsafe_fn)] #[target_feature(enable = "avx")] #[target_feature(enable = "bmi2")] unsafe fn needs_unsafe_block() { sse2(); - //~^ ERROR call to function with `#[target_feature]` is unsafe + //~^ ERROR call to function `sse2` with `#[target_feature]` is unsafe } fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr index 3897f09b576..e17859eb40f 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:25:5 | LL | sse2(); @@ -7,7 +7,7 @@ LL | sse2(); = help: in order for the call to be safe, the context requires the following additional target feature: sse2 = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:27:5 | LL | avx_bmi2(); @@ -15,7 +15,7 @@ LL | avx_bmi2(); | = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:29:5 | LL | Quux.avx_bmi2(); @@ -23,7 +23,7 @@ LL | Quux.avx_bmi2(); | = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:35:5 | LL | avx_bmi2(); @@ -31,7 +31,7 @@ LL | avx_bmi2(); | = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:37:5 | LL | Quux.avx_bmi2(); @@ -39,7 +39,7 @@ LL | Quux.avx_bmi2(); | = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:43:5 | LL | sse2(); @@ -48,7 +48,7 @@ LL | sse2(); = help: in order for the call to be safe, the context requires the following additional target feature: sse2 = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:45:5 | LL | avx_bmi2(); @@ -56,7 +56,7 @@ LL | avx_bmi2(); | = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:47:5 | LL | Quux.avx_bmi2(); @@ -64,7 +64,7 @@ LL | Quux.avx_bmi2(); | = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:54:5 | LL | sse2(); @@ -73,7 +73,7 @@ LL | sse2(); = help: in order for the call to be safe, the context requires the following additional target feature: sse2 = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:58:15 | LL | const _: () = sse2(); @@ -82,7 +82,7 @@ LL | const _: () = sse2(); = help: in order for the call to be safe, the context requires the following additional target feature: sse2 = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block +error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block --> $DIR/safe-calls.rs:61:15 | LL | const _: () = sse2_and_fxsr(); @@ -91,7 +91,7 @@ LL | const _: () = sse2_and_fxsr(); = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` -error: call to function with `#[target_feature]` is unsafe and requires unsafe block (error E0133) +error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133) --> $DIR/safe-calls.rs:68:5 | LL | sse2(); diff --git a/tests/ui/static/safe-extern-statics-mut.stderr b/tests/ui/static/safe-extern-statics-mut.stderr index 38803883414..e390625f20a 100644 --- a/tests/ui/static/safe-extern-statics-mut.stderr +++ b/tests/ui/static/safe-extern-statics-mut.stderr @@ -7,10 +7,10 @@ LL | let b = B; = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:12:14 + --> $DIR/safe-extern-statics-mut.rs:12:15 | LL | let rb = &B; - | ^^ use of mutable static + | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -23,10 +23,10 @@ LL | let xb = XB; = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:14:15 + --> $DIR/safe-extern-statics-mut.rs:14:16 | LL | let xrb = &XB; - | ^^^ use of mutable static + | ^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/tests/ui/static/safe-extern-statics.stderr b/tests/ui/static/safe-extern-statics.stderr index b42572ea3ee..6be6c074c26 100644 --- a/tests/ui/static/safe-extern-statics.stderr +++ b/tests/ui/static/safe-extern-statics.stderr @@ -7,10 +7,10 @@ LL | let a = A; = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:12:14 + --> $DIR/safe-extern-statics.rs:12:15 | LL | let ra = &A; - | ^^ use of extern static + | ^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior @@ -23,10 +23,10 @@ LL | let xa = XA; = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:14:15 + --> $DIR/safe-extern-statics.rs:14:16 | LL | let xra = &XA; - | ^^^ use of extern static + | ^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior diff --git a/tests/ui/static/static-mut-foreign-requires-unsafe.stderr b/tests/ui/static/static-mut-foreign-requires-unsafe.stderr index e7ed0b710b2..022f7e9fb16 100644 --- a/tests/ui/static/static-mut-foreign-requires-unsafe.stderr +++ b/tests/ui/static/static-mut-foreign-requires-unsafe.stderr @@ -2,7 +2,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or bl --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5 | LL | a += 3; - | ^^^^^^ use of mutable static + | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -10,7 +10,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or bl --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5 | LL | a = 4; - | ^^^^^ use of mutable static + | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/tests/ui/static/static-mut-requires-unsafe.stderr b/tests/ui/static/static-mut-requires-unsafe.stderr index 85e468b333c..30be0220cf6 100644 --- a/tests/ui/static/static-mut-requires-unsafe.stderr +++ b/tests/ui/static/static-mut-requires-unsafe.stderr @@ -2,7 +2,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or bl --> $DIR/static-mut-requires-unsafe.rs:4:5 | LL | a += 3; - | ^^^^^^ use of mutable static + | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -10,7 +10,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or bl --> $DIR/static-mut-requires-unsafe.rs:5:5 | LL | a = 4; - | ^^^^^ use of mutable static + | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.stderr index f37fd9db36d..c1777dd60db 100644 --- a/tests/ui/thread-local/thread-local-static.stderr +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -1,3 +1,11 @@ +error[E0133]: use of mutable static is unsafe and requires unsafe function or block + --> $DIR/thread-local-static.rs:10:28 + | +LL | std::mem::swap(x, &mut STATIC_VAR_2) + | ^^^^^^^^^^^^ use of mutable static + | + = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior + error[E0658]: mutable references are not allowed in constant functions --> $DIR/thread-local-static.rs:8:12 | @@ -30,14 +38,6 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:10:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - error: aborting due to 5 previous errors Some errors have detailed explanations: E0013, E0133, E0625, E0658. diff --git a/tests/ui/threads-sendsync/issue-43733.rs b/tests/ui/threads-sendsync/issue-43733.rs index 996abb4809a..671b45e777f 100644 --- a/tests/ui/threads-sendsync/issue-43733.rs +++ b/tests/ui/threads-sendsync/issue-43733.rs @@ -15,11 +15,11 @@ static __KEY: std::thread::local_impl::Key = std::thread::local_impl::Key:: fn __getit(_: Option<&mut Option>>) -> std::option::Option<&'static Foo> { __KEY.get(Default::default) - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `Key::::get` is unsafe } static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); -//~^ ERROR call to unsafe function is unsafe +//~^ ERROR call to unsafe function `LocalKey::::new` is unsafe fn main() { FOO.with(|foo| println!("{}", foo.borrow())); diff --git a/tests/ui/threads-sendsync/issue-43733.stderr b/tests/ui/threads-sendsync/issue-43733.stderr index 9090fd0a4a6..9b13646a228 100644 --- a/tests/ui/threads-sendsync/issue-43733.stderr +++ b/tests/ui/threads-sendsync/issue-43733.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `Key::::get` is unsafe and requires unsafe function or block --> $DIR/issue-43733.rs:17:5 | LL | __KEY.get(Default::default) @@ -6,7 +6,7 @@ LL | __KEY.get(Default::default) | = note: consult the function's documentation for information on how to avoid undefined behavior -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `LocalKey::::new` is unsafe and requires unsafe function or block --> $DIR/issue-43733.rs:21:42 | LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); diff --git a/tests/ui/traits/safety-fn-body.stderr b/tests/ui/traits/safety-fn-body.stderr index 284e73f572d..7a8e6c81a22 100644 --- a/tests/ui/traits/safety-fn-body.stderr +++ b/tests/ui/traits/safety-fn-body.stderr @@ -2,7 +2,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function --> $DIR/safety-fn-body.rs:11:9 | LL | *self += 1; - | ^^^^^^^^^^ dereference of raw pointer + | ^^^^^ 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 diff --git a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr index 404e376e364..94113b336c3 100644 --- a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr +++ b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr @@ -44,11 +44,6 @@ note: ...which requires preparing `Alpha::V3::{constant#0}` for borrow checking. | LL | V3 = Self::V1 {} as u8 + 2, | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires unsafety-checking `Alpha::V3::{constant#0}`... - --> $DIR/self-in-enum-definition.rs:5:10 - | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ note: ...which requires building MIR for `Alpha::V3::{constant#0}`... --> $DIR/self-in-enum-definition.rs:5:10 | diff --git a/tests/ui/union/union-unsafe.stderr b/tests/ui/union/union-unsafe.stderr index 4d3408a89af..82b3f897167 100644 --- a/tests/ui/union/union-unsafe.stderr +++ b/tests/ui/union/union-unsafe.stderr @@ -1,8 +1,8 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:31:5 + --> $DIR/union-unsafe.rs:31:6 | LL | *(u.p) = 13; - | ^^^^^^^^^^^ access to union field + | ^^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -39,18 +39,18 @@ LL | let U1 { a } = u1; = 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-unsafe.rs:61:12 + --> $DIR/union-unsafe.rs:61:20 | LL | if let U1 { a: 12 } = u1 {} - | ^^^^^^^^^^^^ access to union field + | ^^ 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-unsafe.rs:62:12 + --> $DIR/union-unsafe.rs:62:25 | LL | if let Some(U1 { a: 13 }) = Some(u1) {} - | ^^^^^^^^^^^^^^^^^^ access to union field + | ^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior diff --git a/tests/ui/union/union-unsized.stderr b/tests/ui/union/union-unsized.stderr index 3d2e699f630..851ad8939d4 100644 --- a/tests/ui/union/union-unsized.stderr +++ b/tests/ui/union/union-unsized.stderr @@ -17,7 +17,7 @@ LL | a: Box, | ++++ + error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:5:5 + --> $DIR/union-unsized.rs:2:5 | LL | a: str, | ^^^^^^ @@ -46,18 +46,6 @@ help: the `Box` type always has a statically known size and allocates its conten LL | b: Box, | ++++ + -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:2:5 - | -LL | a: str, - | ^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop, - | +++++++++++++++++++++++ + - error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-unsized.rs:11:5 | 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 9e150326f0b..f84f12c8301 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 @@ -8,7 +8,7 @@ unsafe fn unsf() {} unsafe fn foo() { unsf(); - //~^ WARN call to unsafe function is unsafe and requires unsafe block + //~^ WARN call to unsafe function `unsf` is unsafe and requires unsafe block // no unused_unsafe unsafe { diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr index 9ca10b05090..1187c2d80f3 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr @@ -1,4 +1,4 @@ -warning: call to unsafe function is unsafe and requires unsafe block (error E0133) +warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:10:5 | LL | unsf(); diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.rs b/tests/ui/unsafe/foreign-unsafe-fn-called.rs index abbe462021e..b5065beb5fc 100644 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.rs +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.rs @@ -6,5 +6,5 @@ mod test { fn main() { test::free(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `test::free` is unsafe } diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr index b55e6130230..cf2d4c493a1 100644 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.stderr +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe function or block --> $DIR/foreign-unsafe-fn-called.rs:8:5 | LL | test::free(); diff --git a/tests/ui/unsafe/issue-3080.stderr b/tests/ui/unsafe/issue-3080.stderr index f84ba204639..913a601049e 100644 --- a/tests/ui/unsafe/issue-3080.stderr +++ b/tests/ui/unsafe/issue-3080.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `X::with` is unsafe and requires unsafe function or block --> $DIR/issue-3080.rs:7:5 | LL | X(()).with(); diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr index cc1e73bb932..d6cc5fd2e08 100644 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr +++ b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr @@ -2,7 +2,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function --> $DIR/issue-45087-unreachable-unsafe.rs:5:5 | LL | *(1 as *mut u32) = 42; - | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | ^^^^^^^^^^^^^^^^ 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 @@ -10,7 +10,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function --> $DIR/issue-45087-unreachable-unsafe.rs:15:5 | LL | *a = 1; - | ^^^^^^ dereference of raw pointer + | ^^ 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 @@ -18,7 +18,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function --> $DIR/issue-45087-unreachable-unsafe.rs:27:5 | LL | *b = 1; - | ^^^^^^ dereference of raw pointer + | ^^ 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 diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr index 321698e7636..b23c002dc65 100644 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr +++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -16,9 +16,9 @@ LL | #[deny(unused_unsafe)] error: unnecessary `unsafe` block --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:9:38 | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | v.set_len(24); LL | |w: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/unsafe/ranged_ints2_const.stderr b/tests/ui/unsafe/ranged_ints2_const.stderr index a0dc950e76d..f267dc6e23e 100644 --- a/tests/ui/unsafe/ranged_ints2_const.stderr +++ b/tests/ui/unsafe/ranged_ints2_const.stderr @@ -1,3 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints2_const.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[E0658]: mutable references are not allowed in constant functions --> $DIR/ranged_ints2_const.rs:11:13 | @@ -25,14 +33,6 @@ LL | unsafe { let y = &mut x.0; } = note: see issue #57349 for more information = 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: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: aborting due to 4 previous errors Some errors have detailed explanations: E0133, E0658. diff --git a/tests/ui/unsafe/ranged_ints3_const.stderr b/tests/ui/unsafe/ranged_ints3_const.stderr index 215005571f6..75b36cdf94b 100644 --- a/tests/ui/unsafe/ranged_ints3_const.stderr +++ b/tests/ui/unsafe/ranged_ints3_const.stderr @@ -1,3 +1,11 @@ +error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block + --> $DIR/ranged_ints3_const.rs:12: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:12:13 | @@ -16,14 +24,6 @@ LL | let y = unsafe { &x.0 }; = note: see issue #80384 for more information = 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:12: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 3 previous errors Some errors have detailed explanations: E0133, E0658. 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 eceac115edd..658d14da829 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 @@ -7,7 +7,7 @@ static mut VOID: () = (); unsafe fn deny_level() { unsf(); - //~^ ERROR call to unsafe function is unsafe and requires unsafe block + //~^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block *PTR; //~^ ERROR dereference of raw pointer is unsafe and requires unsafe block VOID = (); @@ -22,7 +22,7 @@ unsafe fn deny_level() { #[deny(warnings)] unsafe fn warning_level() { unsf(); - //~^ ERROR call to unsafe function is unsafe and requires unsafe block + //~^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block *PTR; //~^ ERROR dereference of raw pointer is unsafe and requires unsafe block VOID = (); @@ -69,10 +69,10 @@ unsafe fn nested_allow_level() { fn main() { unsf(); - //~^ ERROR call to unsafe function is unsafe and requires unsafe block + //~^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block #[allow(unsafe_op_in_unsafe_fn)] { unsf(); - //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe function or block } } diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr index d61d87cd001..ea0659b2e10 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr @@ -1,4 +1,4 @@ -error: call to unsafe function is unsafe and requires unsafe block (error E0133) +error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:9:5 | LL | unsf(); @@ -28,7 +28,7 @@ error: use of mutable static is unsafe and requires unsafe block (error E0133) --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:13:5 | LL | VOID = (); - | ^^^^^^^^^ use of mutable static + | ^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -44,7 +44,7 @@ note: the lint level is defined here LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ -error: call to unsafe function is unsafe and requires unsafe block (error E0133) +error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:24:5 | LL | unsf(); @@ -75,7 +75,7 @@ error: use of mutable static is unsafe and requires unsafe block (error E0133) --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 | LL | VOID = (); - | ^^^^^^^^^ use of mutable static + | ^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -91,7 +91,7 @@ error: unnecessary `unsafe` block LL | unsafe { unsafe { unsf() } } | ^^^^^^ unnecessary `unsafe` block -error[E0133]: call to unsafe function is unsafe and requires unsafe block +error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:71:5 | LL | unsf(); @@ -99,7 +99,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 +error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe function or block --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:75:9 | LL | unsf(); diff --git a/tests/ui/unsafe/union-assignop.stderr b/tests/ui/unsafe/union-assignop.stderr index e3a673ee1ff..6b2ebfb5099 100644 --- a/tests/ui/unsafe/union-assignop.stderr +++ b/tests/ui/unsafe/union-assignop.stderr @@ -2,7 +2,7 @@ error[E0133]: access to union field is unsafe and requires unsafe function or bl --> $DIR/union-assignop.rs:16:5 | LL | foo.a += 5; - | ^^^^^^^^^^ access to union field + | ^^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior diff --git a/tests/ui/unsafe/union.rs b/tests/ui/unsafe/union.rs index 83ec1c3cd6c..ae81708aa19 100644 --- a/tests/ui/unsafe/union.rs +++ b/tests/ui/unsafe/union.rs @@ -26,20 +26,19 @@ pub fn main() { match foo { Foo { bar: _a } => {}, //~ ERROR access to union field is unsafe } - match foo { //~ ERROR access to union field is unsafe + match foo { Foo { - pizza: Pizza { + pizza: Pizza { //~ ERROR access to union field is unsafe topping: Some(PizzaTopping::Cheese) | Some(PizzaTopping::Pineapple) | None } } => {}, } - // MIR unsafeck incorrectly thinks that no unsafe block is needed to do these match foo { - Foo { zst: () } => {}, + Foo { zst: () } => {} //~ ERROR access to union field is unsafe } match foo { - Foo { pizza: Pizza { .. } } => {}, + Foo { pizza: Pizza { .. } } => {} //~ ERROR access to union field is unsafe } // binding to wildcard is okay diff --git a/tests/ui/unsafe/union.stderr b/tests/ui/unsafe/union.stderr index fe814462412..1506bdb919b 100644 --- a/tests/ui/unsafe/union.stderr +++ b/tests/ui/unsafe/union.stderr @@ -7,13 +7,32 @@ 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:29:11 + --> $DIR/union.rs:31:20 | -LL | match foo { - | ^^^ access to union field +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: aborting due to 2 previous errors +error[E0133]: access to union field is unsafe and requires unsafe function or block + --> $DIR/union.rs:38: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:41: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_destructure.rs b/tests/ui/unsafe/union_destructure.rs index 85fd54c8145..d0cf8640eaa 100644 --- a/tests/ui/unsafe/union_destructure.rs +++ b/tests/ui/unsafe/union_destructure.rs @@ -10,7 +10,7 @@ struct Pie { union Foo { #[allow(dead_code)] bar: i8, - baz: Pie + baz: Pie, } fn main() { @@ -30,20 +30,20 @@ fn main() { }; let u = Foo { bar: 9 }; - unsafe { //~ WARNING unnecessary `unsafe` block + unsafe { match u { - Foo { baz: Pie { .. } } => {}, + Foo { baz: Pie { .. } } => {} }; } let u = Foo { bar: 10 }; - unsafe { //~ WARNING unnecessary `unsafe` block + unsafe { match u { - Foo { baz: Pie { slices: _, size: _ } } => {}, + Foo { baz: Pie { slices: _, size: _ } } => {} }; } let u = Foo { bar: 11 }; match u { - Foo { baz: _ } => {}, + Foo { baz: _ } => {} }; } diff --git a/tests/ui/unsafe/union_destructure.stderr b/tests/ui/unsafe/union_destructure.stderr deleted file mode 100644 index 431521472e8..00000000000 --- a/tests/ui/unsafe/union_destructure.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:33:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: `#[warn(unused_unsafe)]` on by default - -warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:39:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -warning: 2 warnings emitted - diff --git a/tests/ui/unsafe/unsafe-const-fn.stderr b/tests/ui/unsafe/unsafe-const-fn.stderr index 8d7f09a1edb..5a6e6b7ce59 100644 --- a/tests/ui/unsafe/unsafe-const-fn.stderr +++ b/tests/ui/unsafe/unsafe-const-fn.stderr @@ -1,4 +1,4 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `dummy` is unsafe and requires unsafe function or block --> $DIR/unsafe-const-fn.rs:7:18 | LL | const VAL: u32 = dummy(0xFFFF); diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr index d79cbd466c2..3a0874f32c0 100644 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr +++ b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -2,7 +2,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function --> $DIR/unsafe-fn-assign-deref-ptr.rs:2:5 | LL | *p = 0; - | ^^^^^^ dereference of raw pointer + | ^^ 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 diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.rs b/tests/ui/unsafe/unsafe-fn-called-from-safe.rs index 1836629958a..758b80097f7 100644 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.rs +++ b/tests/ui/unsafe/unsafe-fn-called-from-safe.rs @@ -1,6 +1,8 @@ -unsafe fn f() { return; } +unsafe fn f() { + return; +} fn main() { f(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `f` is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr index 51aba0ba6d7..1b1c92f0546 100644 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.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:4:5 +error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-called-from-safe.rs:6:5 | LL | f(); | ^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.rs b/tests/ui/unsafe/unsafe-fn-used-as-value.rs index a47189d265f..99506ea047c 100644 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.rs +++ b/tests/ui/unsafe/unsafe-fn-used-as-value.rs @@ -1,7 +1,9 @@ -unsafe fn f() { return; } +unsafe fn f() { + return; +} fn main() { let x = f; x(); - //~^ ERROR call to unsafe function is unsafe + //~^ ERROR call to unsafe function `f` is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.stderr index 1625de184d2..0542b87b5e6 100644 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.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:5:5 +error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block + --> $DIR/unsafe-fn-used-as-value.rs:7:5 | LL | x(); | ^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-not-inherited.stderr b/tests/ui/unsafe/unsafe-not-inherited.stderr index 3bc5ca5c9d1..8b699127312 100644 --- a/tests/ui/unsafe/unsafe-not-inherited.stderr +++ b/tests/ui/unsafe/unsafe-not-inherited.stderr @@ -8,7 +8,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 +error[E0133]: call to unsafe function `unsafe_call` is unsafe and requires unsafe function or block --> $DIR/unsafe-not-inherited.rs:18:13 | LL | unsafe { diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed index f776cffed59..20f4fe847da 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed @@ -10,10 +10,10 @@ unsafe fn unsf() {} pub unsafe fn foo() { unsafe { //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //~ ERROR call to unsafe function is unsafe + unsf(); //~ ERROR call to unsafe function `unsf` is unsafe //~^ NOTE //~| NOTE - unsf(); //~ ERROR call to unsafe function is unsafe + unsf(); //~ ERROR call to unsafe function `unsf` is unsafe //~^ NOTE //~| NOTE }} @@ -40,10 +40,10 @@ pub unsafe fn baz() -> i32 { unsafe { }} macro_rules! unsafe_macro { () => (unsf()) } -//~^ ERROR call to unsafe function is unsafe +//~^ ERROR call to unsafe function `unsf` is unsafe //~| NOTE //~| NOTE -//~| ERROR call to unsafe function is unsafe +//~| ERROR call to unsafe function `unsf` 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 13ab51ef432..13a446d2d24 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs @@ -10,10 +10,10 @@ unsafe fn unsf() {} pub unsafe fn foo() { //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //~ ERROR call to unsafe function is unsafe + unsf(); //~ ERROR call to unsafe function `unsf` is unsafe //~^ NOTE //~| NOTE - unsf(); //~ ERROR call to unsafe function is unsafe + unsf(); //~ ERROR call to unsafe function `unsf` is unsafe //~^ NOTE //~| NOTE } @@ -40,10 +40,10 @@ pub unsafe fn baz() -> i32 { } macro_rules! unsafe_macro { () => (unsf()) } -//~^ ERROR call to unsafe function is unsafe +//~^ ERROR call to unsafe function `unsf` is unsafe //~| NOTE //~| NOTE -//~| ERROR call to unsafe function is unsafe +//~| ERROR call to unsafe function `unsf` is unsafe //~| NOTE //~| NOTE diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr index 9ae238d5a79..84b58bc0288 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr @@ -1,4 +1,4 @@ -error: call to unsafe function is unsafe and requires unsafe block (error E0133) +error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:13:5 | LL | unsf(); @@ -16,7 +16,7 @@ note: the lint level is defined here LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ -error: call to unsafe function is unsafe and requires unsafe block (error E0133) +error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:16:5 | LL | unsf(); @@ -66,7 +66,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) +error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:42:36 | LL | macro_rules! unsafe_macro { () => (unsf()) } @@ -83,7 +83,7 @@ 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) +error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) --> $DIR/wrapping-unsafe-block-sugg.rs:42:36 | LL | macro_rules! unsafe_macro { () => (unsf()) } -- cgit 1.4.1-3-g733a5 From 7832ebbd4ff090aced6e338ff92e1353bbe88f76 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 22 Dec 2023 16:38:20 +0000 Subject: Handle context for const patterns correctly --- compiler/rustc_mir_build/src/check_unsafety.rs | 8 +++++++- tests/ui/unsafe/const_pat_in_layout_restricted.rs | 24 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/ui/unsafe/const_pat_in_layout_restricted.rs diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 7d0ce53997a..b4a02fae454 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -144,11 +144,17 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { let hir_context = self.tcx.local_def_id_to_hir_id(def); let safety_context = mem::replace(&mut self.safety_context, SafetyContext::Safe); let mut inner_visitor = UnsafetyVisitor { + tcx: self.tcx, thir: inner_thir, hir_context, safety_context, + body_target_features: self.body_target_features, + assignment_info: self.assignment_info, + in_union_destructure: false, + param_env: self.param_env, + inside_adt: false, warnings: self.warnings, - ..*self + suggest_unsafe_block: self.suggest_unsafe_block, }; inner_visitor.visit_expr(&inner_thir[expr]); // Unsafe blocks can be used in the inner body, make sure to take it into account diff --git a/tests/ui/unsafe/const_pat_in_layout_restricted.rs b/tests/ui/unsafe/const_pat_in_layout_restricted.rs new file mode 100644 index 00000000000..5bc7a7113e4 --- /dev/null +++ b/tests/ui/unsafe/const_pat_in_layout_restricted.rs @@ -0,0 +1,24 @@ +// Check that ref mut patterns within a const pattern don't get considered +// unsafe because they're within a pattern for a layout constrained stuct. +// check-pass + +#![allow(incomplete_features)] +#![feature(rustc_attrs)] +#![feature(inline_const_pat)] + +#[rustc_layout_scalar_valid_range_start(3)] +struct Gt2(i32); + +fn main() { + match unsafe { Gt2(5) } { + Gt2( + const { + || match () { + ref mut y => (), + }; + 4 + }, + ) => (), + _ => (), + } +} -- cgit 1.4.1-3-g733a5