From 982b49494e7a50adb94eae42144cfa51229ac127 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 26 Oct 2023 16:13:20 +0000 Subject: [PATCH 1/3] 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.rs | 2 - ...rch.mirunsafeck.stderr => bad-arch.stderr} | 4 +- tests/ui/asm/bad-arch.thirunsafeck.stderr | 17 - ...eck.stderr => bad-template.aarch64.stderr} | 52 +- .../bad-template.aarch64_thirunsafeck.stderr | 202 --- tests/ui/asm/bad-template.rs | 22 +- ...feck.stderr => bad-template.x86_64.stderr} | 52 +- .../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.rs | 14 +- ...rr => async-unsafe-fn-call-in-safe.stderr} | 8 +- .../async-unsafe-fn-call-in-safe.thir.stderr | 35 - .../closure_no_cap_coerce_many_unsafe_0.rs | 3 - ...losure_no_cap_coerce_many_unsafe_0.stderr} | 4 +- .../coerce-unsafe-closure-to-unsafe-fn-ptr.rs | 3 - ...ce-unsafe-closure-to-unsafe-fn-ptr.stderr} | 2 +- ...nsafe-closure-to-unsafe-fn-ptr.thir.stderr | 11 - .../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} | 12 +- tests/ui/consts/issue-16538.rs | 3 - ...ue-16538.mir.stderr => issue-16538.stderr} | 6 +- tests/ui/consts/issue-16538.thir.stderr | 29 - .../issue-45729-unsafe-in-coroutine.rs | 3 - ...=> issue-45729-unsafe-in-coroutine.stderr} | 2 +- ...ssue-45729-unsafe-in-coroutine.thir.stderr | 11 - .../static-mut-reference-across-yield.rs | 2 - tests/ui/error-codes/E0133.rs | 3 - .../{E0133.mir.stderr => E0133.stderr} | 2 +- tests/ui/error-codes/E0133.thir.stderr | 11 - tests/ui/extern/issue-28324.rs | 3 - ...ue-28324.mir.stderr => issue-28324.stderr} | 2 +- tests/ui/extern/issue-28324.thir.stderr | 11 - tests/ui/inline-const/expr-unsafe-err.rs | 6 +- ...-err.mir.stderr => expr-unsafe-err.stderr} | 0 .../inline-const/expr-unsafe-err.thir.stderr | 11 - tests/ui/inline-const/expr-unsafe.rs | 3 +- ...r-unsafe.mir.stderr => expr-unsafe.stderr} | 4 +- tests/ui/inline-const/expr-unsafe.thir.stderr | 14 - tests/ui/inline-const/pat-unsafe-err.rs | 4 +- .../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.rs | 3 - ...ue-28575.mir.stderr => issue-28575.stderr} | 2 +- tests/ui/intrinsics/issue-28575.thir.stderr | 11 - tests/ui/intrinsics/unchecked_math_unsafe.rs | 3 - ...ir.stderr => unchecked_math_unsafe.stderr} | 6 +- .../unchecked_math_unsafe.thir.stderr | 27 - tests/ui/issues/issue-11740.rs | 2 - tests/ui/issues/issue-28776.rs | 3 - ...ue-28776.mir.stderr => issue-28776.stderr} | 2 +- 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 - ...e-48131.thir.stderr => issue-48131.stderr} | 6 +- tests/ui/issues/issue-5844.rs | 4 +- ...ssue-5844.mir.stderr => issue-5844.stderr} | 2 +- tests/ui/issues/issue-5844.thir.stderr | 11 - tests/ui/lto/lto-still-runs-thread-dtors.rs | 2 - .../non-structural-match-types.mir.stderr | 14 - .../ui/pattern/non-structural-match-types.rs | 2 - .../pattern/non-structural-match-types.stderr | 14 + .../non-structural-match-types.thir.stderr | 14 - tests/ui/process/no-stdio.rs | 2 - .../rfc-2396-target_feature-11/check-pass.rs | 2 - .../closures-inherit-target_feature.rs | 6 +- .../rfcs/rfc-2396-target_feature-11/fn-ptr.rs | 2 - .../rfc-2396-target_feature-11/fn-ptr.stderr | 23 + .../issue-108655-inline-always-closure.rs | 2 - .../rfc-2396-target_feature-11/safe-calls.rs | 39 +- .../safe-calls.stderr | 115 ++ tests/ui/runtime/running-with-no-runtime.rs | 2 - .../simd/intrinsic/generic-comparison-pass.rs | 2 - tests/ui/span/lint-unused-unsafe.rs | 3 - ...e.mir.stderr => lint-unused-unsafe.stderr} | 376 ++--- tests/ui/span/lint-unused-unsafe.thir.stderr | 1402 ----------------- tests/ui/static/safe-extern-statics-mut.rs | 2 - ....stderr => safe-extern-statics-mut.stderr} | 8 +- .../safe-extern-statics-mut.thir.stderr | 35 - tests/ui/static/safe-extern-statics.rs | 2 - ....mir.stderr => safe-extern-statics.stderr} | 8 +- .../ui/static/safe-extern-statics.thir.stderr | 35 - .../static-mut-foreign-requires-unsafe.rs | 3 - ...static-mut-foreign-requires-unsafe.stderr} | 6 +- ...ic-mut-foreign-requires-unsafe.thir.stderr | 27 - tests/ui/static/static-mut-requires-unsafe.rs | 3 - ...derr => static-mut-requires-unsafe.stderr} | 6 +- .../static-mut-requires-unsafe.thir.stderr | 27 - tests/ui/statics/issue-14227.rs | 3 - ...ue-14227.mir.stderr => issue-14227.stderr} | 2 +- tests/ui/statics/issue-14227.thir.stderr | 11 - tests/ui/thread-local/thread-local-static.rs | 2 - ....mir.stderr => thread-local-static.stderr} | 10 +- .../thread-local-static.thir.stderr | 44 - tests/ui/threads-sendsync/issue-43733.rs | 8 +- ...ue-43733.mir.stderr => issue-43733.stderr} | 4 +- .../threads-sendsync/issue-43733.thir.stderr | 19 - tests/ui/traits/safety-fn-body.rs | 3 - ...-body.mir.stderr => safety-fn-body.stderr} | 2 +- 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 - .../union/union-borrow-move-parent-sibling.rs | 3 - ...> union-borrow-move-parent-sibling.stderr} | 14 +- ...ow-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.rs | 3 - ....mirunsafeck.stderr => union-deref.stderr} | 12 +- .../ui/union/union-deref.thirunsafeck.stderr | 56 - tests/ui/union/union-derive-clone.rs | 3 - ...afeck.stderr => union-derive-clone.stderr} | 6 +- .../union-derive-clone.thirunsafeck.stderr | 45 - tests/ui/union/union-derive-eq.rs | 3 - ...unsafeck.stderr => union-derive-eq.stderr} | 2 +- .../union/union-derive-eq.thirunsafeck.stderr | 21 - tests/ui/union/union-derive-rpass.rs | 2 - tests/ui/union/union-drop.rs | 2 - .../union/union-fields-1.mirunsafeck.stderr | 42 - tests/ui/union/union-fields-1.rs | 3 - ...runsafeck.stderr => union-fields-1.stderr} | 10 +- tests/ui/union/union-fields-2.rs | 3 - ...runsafeck.stderr => union-fields-2.stderr} | 26 +- .../union/union-fields-2.thirunsafeck.stderr | 84 - tests/ui/union/union-generic-rpass.rs | 3 - tests/ui/union/union-generic.rs | 3 - ...irunsafeck.stderr => union-generic.stderr} | 8 +- .../union/union-generic.thirunsafeck.stderr | 27 - tests/ui/union/union-inherent-method.rs | 2 - tests/ui/union/union-lint-dead-code.rs | 3 - ...eck.stderr => union-lint-dead-code.stderr} | 4 +- .../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.rs | 3 - ...e.mirunsafeck.stderr => union-move.stderr} | 10 +- 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 +- tests/ui/union/union-suggest-field.rs | 3 - ...feck.stderr => union-suggest-field.stderr} | 6 +- .../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.rs | 4 - ...-unsafe.mir.stderr => union-unsafe.stderr} | 20 +- tests/ui/union/union-unsafe.thir.stderr | 83 - tests/ui/union/union-unsized.rs | 3 - ...irunsafeck.stderr => union-unsized.stderr} | 18 +- .../union/union-unsized.thirunsafeck.stderr | 64 - tests/ui/union/union-with-drop-fields.rs | 3 - ...k.stderr => union-with-drop-fields.stderr} | 6 +- ...union-with-drop-fields.thirunsafeck.stderr | 39 - tests/ui/unsafe/access_union_field.rs | 3 - ...d.mir.stderr => access_union_field.stderr} | 4 +- .../ui/unsafe/access_union_field.thir.stderr | 19 - .../edition-2024-unsafe_op_in_unsafe_fn.rs | 6 +- ...dition-2024-unsafe_op_in_unsafe_fn.stderr} | 4 +- ...on-2024-unsafe_op_in_unsafe_fn.thir.stderr | 16 - tests/ui/unsafe/foreign-unsafe-fn-called.rs | 6 +- ...stderr => foreign-unsafe-fn-called.stderr} | 2 +- .../foreign-unsafe-fn-called.thir.stderr | 11 - tests/ui/unsafe/inline_asm.rs | 2 - ...nline_asm.mir.stderr => inline_asm.stderr} | 2 +- tests/ui/unsafe/inline_asm.thir.stderr | 11 - tests/ui/unsafe/issue-3080.rs | 3 - ...ssue-3080.mir.stderr => issue-3080.stderr} | 2 +- tests/ui/unsafe/issue-3080.thir.stderr | 11 - .../unsafe/issue-45087-unreachable-unsafe.rs | 2 - ... => issue-45087-unreachable-unsafe.stderr} | 6 +- ...issue-45087-unreachable-unsafe.thir.stderr | 27 - ...sue-45107-unnecessary-unsafe-in-closure.rs | 3 - ...5107-unnecessary-unsafe-in-closure.stderr} | 8 +- ...-unnecessary-unsafe-in-closure.thir.stderr | 35 - tests/ui/unsafe/issue-47412.rs | 3 - ...ue-47412.mir.stderr => issue-47412.stderr} | 4 +- tests/ui/unsafe/issue-47412.thir.stderr | 19 - ...fe-op-in-let-under-unsafe-under-closure.rs | 2 - tests/ui/unsafe/issue-87414-query-cycle.rs | 1 - tests/ui/unsafe/ranged_ints.rs | 3 - ...ged_ints.mir.stderr => ranged_ints.stderr} | 2 +- tests/ui/unsafe/ranged_ints.thir.stderr | 11 - tests/ui/unsafe/ranged_ints2.rs | 3 - ...mirunsafeck.stderr => ranged_ints2.stderr} | 4 +- .../unsafe/ranged_ints2.thirunsafeck.stderr | 19 - tests/ui/unsafe/ranged_ints2_const.rs | 3 - ...afeck.stderr => ranged_ints2_const.stderr} | 8 +- .../ranged_ints2_const.thirunsafeck.stderr | 39 - tests/ui/unsafe/ranged_ints3.rs | 3 - ...mirunsafeck.stderr => ranged_ints3.stderr} | 2 +- .../unsafe/ranged_ints3.thirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints3_const.rs | 3 - ...afeck.stderr => ranged_ints3_const.stderr} | 6 +- .../ranged_ints3_const.thirunsafeck.stderr | 30 - tests/ui/unsafe/ranged_ints3_match.rs | 3 - ...afeck.stderr => ranged_ints3_match.stderr} | 4 +- .../ranged_ints3_match.thirunsafeck.stderr | 19 - .../ui/unsafe/ranged_ints4.mirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints4.rs | 3 - ...hirunsafeck.stderr => ranged_ints4.stderr} | 2 +- tests/ui/unsafe/ranged_ints4_const.rs | 3 - ...afeck.stderr => ranged_ints4_const.stderr} | 2 +- .../ranged_ints4_const.thirunsafeck.stderr | 11 - tests/ui/unsafe/ranged_ints_const.rs | 3 - ...st.mir.stderr => ranged_ints_const.stderr} | 2 +- tests/ui/unsafe/ranged_ints_const.thir.stderr | 11 - tests/ui/unsafe/ranged_ints_macro.rs | 2 - .../unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs | 15 +- ...=> rfc-2585-unsafe_op_in_unsafe_fn.stderr} | 32 +- ...fc-2585-unsafe_op_in_unsafe_fn.thir.stderr | 112 -- tests/ui/unsafe/union-assignop.rs | 3 - ...runsafeck.stderr => union-assignop.stderr} | 12 +- .../unsafe/union-assignop.thirunsafeck.stderr | 51 - tests/ui/unsafe/union-modification.rs | 3 - tests/ui/unsafe/union.rs | 11 +- .../unsafe/{union.mir.stderr => union.stderr} | 4 +- tests/ui/unsafe/union.thir.stderr | 38 - tests/ui/unsafe/union_access_through_block.rs | 3 - tests/ui/unsafe/union_destructure.rs | 6 +- ...re.mir.stderr => union_destructure.stderr} | 4 +- tests/ui/unsafe/union_wild_or_wild.rs | 3 - ...round-compiler-generated-unsafe.mir.stderr | 20 - ...unsafe-around-compiler-generated-unsafe.rs | 2 - ...e-around-compiler-generated-unsafe.stderr} | 6 +- tests/ui/unsafe/unsafe-assign.rs | 3 - ...irunsafeck.stderr => unsafe-assign.stderr} | 2 +- .../unsafe/unsafe-assign.thirunsafeck.stderr | 11 - tests/ui/unsafe/unsafe-borrow.rs | 3 - ...irunsafeck.stderr => unsafe-borrow.stderr} | 6 +- .../unsafe/unsafe-borrow.thirunsafeck.stderr | 27 - tests/ui/unsafe/unsafe-const-fn.rs | 3 - ...t-fn.mir.stderr => unsafe-const-fn.stderr} | 2 +- tests/ui/unsafe/unsafe-const-fn.thir.stderr | 11 - tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs | 3 - ...derr => unsafe-fn-assign-deref-ptr.stderr} | 2 +- .../unsafe-fn-assign-deref-ptr.thir.stderr | 11 - tests/ui/unsafe/unsafe-fn-called-from-safe.rs | 6 +- ...derr => unsafe-fn-called-from-safe.stderr} | 2 +- .../unsafe-fn-called-from-safe.thir.stderr | 11 - tests/ui/unsafe/unsafe-fn-deref-ptr.rs | 3 - ....mir.stderr => unsafe-fn-deref-ptr.stderr} | 8 +- .../ui/unsafe/unsafe-fn-deref-ptr.thir.stderr | 35 - tests/ui/unsafe/unsafe-fn-used-as-value.rs | 6 +- ....stderr => unsafe-fn-used-as-value.stderr} | 2 +- .../unsafe-fn-used-as-value.thir.stderr | 11 - tests/ui/unsafe/unsafe-not-inherited.rs | 2 - ...eck.stderr => unsafe-not-inherited.stderr} | 4 +- .../unsafe-not-inherited.thirunsafeck.stderr | 24 - tests/ui/unsafe/unsafe-unstable-const-fn.rs | 3 - ...stderr => unsafe-unstable-const-fn.stderr} | 2 +- .../unsafe-unstable-const-fn.thir.stderr | 11 - ...fixed => wrapping-unsafe-block-sugg.fixed} | 18 +- tests/ui/unsafe/wrapping-unsafe-block-sugg.rs | 18 +- ...derr => wrapping-unsafe-block-sugg.stderr} | 26 +- .../wrapping-unsafe-block-sugg.thir.fixed | 73 - .../wrapping-unsafe-block-sugg.thir.stderr | 99 -- 266 files changed, 694 insertions(+), 4667 deletions(-) rename tests/ui/asm/{bad-arch.mirunsafeck.stderr => bad-arch.stderr} (89%) delete mode 100644 tests/ui/asm/bad-arch.thirunsafeck.stderr rename tests/ui/asm/{bad-template.aarch64_mirunsafeck.stderr => bad-template.aarch64.stderr} (86%) delete mode 100644 tests/ui/asm/bad-template.aarch64_thirunsafeck.stderr rename tests/ui/asm/{bad-template.x86_64_mirunsafeck.stderr => bad-template.x86_64.stderr} (86%) delete mode 100644 tests/ui/asm/bad-template.x86_64_thirunsafeck.stderr rename tests/ui/async-await/{async-unsafe-fn-call-in-safe.mir.stderr => async-unsafe-fn-call-in-safe.stderr} (88%) delete mode 100644 tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr rename tests/ui/closures/{closure_no_cap_coerce_many_unsafe_0.mir.stderr => closure_no_cap_coerce_many_unsafe_0.stderr} (86%) rename tests/ui/closures/{coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr => coerce-unsafe-closure-to-unsafe-fn-ptr.stderr} (89%) delete mode 100644 tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr rename tests/ui/{closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr => consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr} (61%) rename tests/ui/consts/{issue-16538.mir.stderr => issue-16538.stderr} (93%) delete mode 100644 tests/ui/consts/issue-16538.thir.stderr rename tests/ui/coroutine/{issue-45729-unsafe-in-coroutine.mir.stderr => issue-45729-unsafe-in-coroutine.stderr} (90%) delete mode 100644 tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr rename tests/ui/error-codes/{E0133.mir.stderr => E0133.stderr} (93%) delete mode 100644 tests/ui/error-codes/E0133.thir.stderr rename tests/ui/extern/{issue-28324.mir.stderr => issue-28324.stderr} (93%) delete mode 100644 tests/ui/extern/issue-28324.thir.stderr rename tests/ui/inline-const/{expr-unsafe-err.mir.stderr => expr-unsafe-err.stderr} (100%) delete mode 100644 tests/ui/inline-const/expr-unsafe-err.thir.stderr rename tests/ui/inline-const/{expr-unsafe.mir.stderr => expr-unsafe.stderr} (80%) 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 rename tests/ui/intrinsics/{issue-28575.mir.stderr => issue-28575.stderr} (92%) delete mode 100644 tests/ui/intrinsics/issue-28575.thir.stderr rename tests/ui/intrinsics/{unchecked_math_unsafe.mir.stderr => unchecked_math_unsafe.stderr} (89%) delete mode 100644 tests/ui/intrinsics/unchecked_math_unsafe.thir.stderr rename tests/ui/issues/{issue-28776.mir.stderr => issue-28776.stderr} (93%) delete mode 100644 tests/ui/issues/issue-28776.thir.stderr delete mode 100644 tests/ui/issues/issue-48131.mir.stderr rename tests/ui/issues/{issue-48131.thir.stderr => issue-48131.stderr} (81%) rename tests/ui/issues/{issue-5844.mir.stderr => issue-5844.stderr} (93%) 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 rename tests/ui/span/{lint-unused-unsafe.mir.stderr => lint-unused-unsafe.stderr} (83%) delete mode 100644 tests/ui/span/lint-unused-unsafe.thir.stderr rename tests/ui/static/{safe-extern-statics-mut.mir.stderr => safe-extern-statics-mut.stderr} (87%) delete mode 100644 tests/ui/static/safe-extern-statics-mut.thir.stderr rename tests/ui/static/{safe-extern-statics.mir.stderr => safe-extern-statics.stderr} (89%) delete mode 100644 tests/ui/static/safe-extern-statics.thir.stderr rename tests/ui/static/{static-mut-foreign-requires-unsafe.mir.stderr => static-mut-foreign-requires-unsafe.stderr} (85%) delete mode 100644 tests/ui/static/static-mut-foreign-requires-unsafe.thir.stderr rename tests/ui/static/{static-mut-requires-unsafe.mir.stderr => static-mut-requires-unsafe.stderr} (87%) delete mode 100644 tests/ui/static/static-mut-requires-unsafe.thir.stderr rename tests/ui/statics/{issue-14227.mir.stderr => issue-14227.stderr} (93%) delete mode 100644 tests/ui/statics/issue-14227.thir.stderr rename tests/ui/thread-local/{thread-local-static.mir.stderr => thread-local-static.stderr} (88%) delete mode 100644 tests/ui/thread-local/thread-local-static.thir.stderr rename tests/ui/threads-sendsync/{issue-43733.mir.stderr => issue-43733.stderr} (92%) delete mode 100644 tests/ui/threads-sendsync/issue-43733.thir.stderr rename tests/ui/traits/{safety-fn-body.mir.stderr => safety-fn-body.stderr} (92%) delete mode 100644 tests/ui/traits/safety-fn-body.thir.stderr rename tests/ui/union/{union-borrow-move-parent-sibling.mirunsafeck.stderr => union-borrow-move-parent-sibling.stderr} (89%) delete mode 100644 tests/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr rename tests/ui/union/{union-deref.mirunsafeck.stderr => union-deref.stderr} (91%) delete mode 100644 tests/ui/union/union-deref.thirunsafeck.stderr rename tests/ui/union/{union-derive-clone.mirunsafeck.stderr => union-derive-clone.stderr} (92%) delete mode 100644 tests/ui/union/union-derive-clone.thirunsafeck.stderr rename tests/ui/union/{union-derive-eq.mirunsafeck.stderr => union-derive-eq.stderr} (95%) delete mode 100644 tests/ui/union/union-derive-eq.thirunsafeck.stderr delete mode 100644 tests/ui/union/union-fields-1.mirunsafeck.stderr rename tests/ui/union/{union-fields-1.thirunsafeck.stderr => union-fields-1.stderr} (82%) rename tests/ui/union/{union-fields-2.mirunsafeck.stderr => union-fields-2.stderr} (86%) delete mode 100644 tests/ui/union/union-fields-2.thirunsafeck.stderr rename tests/ui/union/{union-generic.mirunsafeck.stderr => union-generic.stderr} (84%) delete mode 100644 tests/ui/union/union-generic.thirunsafeck.stderr rename tests/ui/union/{union-lint-dead-code.mirunsafeck.stderr => union-lint-dead-code.stderr} (77%) delete mode 100644 tests/ui/union/union-lint-dead-code.thirunsafeck.stderr rename tests/ui/union/{union-move.mirunsafeck.stderr => union-move.stderr} (91%) delete mode 100644 tests/ui/union/union-move.thirunsafeck.stderr rename tests/ui/union/{union-suggest-field.mirunsafeck.stderr => union-suggest-field.stderr} (88%) delete mode 100644 tests/ui/union/union-suggest-field.thirunsafeck.stderr rename tests/ui/union/{union-unsafe.mir.stderr => union-unsafe.stderr} (91%) delete mode 100644 tests/ui/union/union-unsafe.thir.stderr rename tests/ui/union/{union-unsized.mirunsafeck.stderr => union-unsized.stderr} (80%) delete mode 100644 tests/ui/union/union-unsized.thirunsafeck.stderr rename tests/ui/union/{union-with-drop-fields.mirunsafeck.stderr => union-with-drop-fields.stderr} (91%) delete mode 100644 tests/ui/union/union-with-drop-fields.thirunsafeck.stderr rename tests/ui/unsafe/{access_union_field.mir.stderr => access_union_field.stderr} (89%) delete mode 100644 tests/ui/unsafe/access_union_field.thir.stderr rename tests/ui/unsafe/{edition-2024-unsafe_op_in_unsafe_fn.mir.stderr => edition-2024-unsafe_op_in_unsafe_fn.stderr} (80%) delete mode 100644 tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr rename tests/ui/unsafe/{foreign-unsafe-fn-called.mir.stderr => foreign-unsafe-fn-called.stderr} (89%) delete mode 100644 tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr rename tests/ui/unsafe/{inline_asm.mir.stderr => inline_asm.stderr} (92%) delete mode 100644 tests/ui/unsafe/inline_asm.thir.stderr rename tests/ui/unsafe/{issue-3080.mir.stderr => issue-3080.stderr} (92%) delete mode 100644 tests/ui/unsafe/issue-3080.thir.stderr rename tests/ui/unsafe/{issue-45087-unreachable-unsafe.mir.stderr => issue-45087-unreachable-unsafe.stderr} (87%) delete mode 100644 tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr rename tests/ui/unsafe/{issue-45107-unnecessary-unsafe-in-closure.mir.stderr => issue-45107-unnecessary-unsafe-in-closure.stderr} (78%) delete mode 100644 tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr rename tests/ui/unsafe/{issue-47412.mir.stderr => issue-47412.stderr} (91%) delete mode 100644 tests/ui/unsafe/issue-47412.thir.stderr rename tests/ui/unsafe/{ranged_ints.mir.stderr => ranged_ints.stderr} (93%) delete mode 100644 tests/ui/unsafe/ranged_ints.thir.stderr rename tests/ui/unsafe/{ranged_ints2.mirunsafeck.stderr => ranged_ints2.stderr} (91%) delete mode 100644 tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr rename tests/ui/unsafe/{ranged_ints2_const.mirunsafeck.stderr => ranged_ints2_const.stderr} (90%) delete mode 100644 tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr rename tests/ui/unsafe/{ranged_ints3.mirunsafeck.stderr => ranged_ints3.stderr} (93%) delete mode 100644 tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr rename tests/ui/unsafe/{ranged_ints3_const.mirunsafeck.stderr => ranged_ints3_const.stderr} (91%) delete mode 100644 tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr rename tests/ui/unsafe/{ranged_ints3_match.mirunsafeck.stderr => ranged_ints3_match.stderr} (91%) delete mode 100644 tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr delete mode 100644 tests/ui/unsafe/ranged_ints4.mirunsafeck.stderr rename tests/ui/unsafe/{ranged_ints4.thirunsafeck.stderr => ranged_ints4.stderr} (92%) rename tests/ui/unsafe/{ranged_ints4_const.mirunsafeck.stderr => ranged_ints4_const.stderr} (90%) delete mode 100644 tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr rename tests/ui/unsafe/{ranged_ints_const.mir.stderr => ranged_ints_const.stderr} (93%) delete mode 100644 tests/ui/unsafe/ranged_ints_const.thir.stderr rename tests/ui/unsafe/{rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr => rfc-2585-unsafe_op_in_unsafe_fn.stderr} (81%) delete mode 100644 tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr rename tests/ui/unsafe/{union-assignop.mirunsafeck.stderr => union-assignop.stderr} (89%) delete mode 100644 tests/ui/unsafe/union-assignop.thirunsafeck.stderr rename tests/ui/unsafe/{union.mir.stderr => union.stderr} (92%) delete mode 100644 tests/ui/unsafe/union.thir.stderr rename tests/ui/unsafe/{union_destructure.mir.stderr => union_destructure.stderr} (79%) delete mode 100644 tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr rename tests/ui/unsafe/{unsafe-around-compiler-generated-unsafe.thir.stderr => unsafe-around-compiler-generated-unsafe.stderr} (69%) rename tests/ui/unsafe/{unsafe-assign.mirunsafeck.stderr => unsafe-assign.stderr} (92%) delete mode 100644 tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr rename tests/ui/unsafe/{unsafe-borrow.mirunsafeck.stderr => unsafe-borrow.stderr} (90%) delete mode 100644 tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr rename tests/ui/unsafe/{unsafe-const-fn.mir.stderr => unsafe-const-fn.stderr} (91%) delete mode 100644 tests/ui/unsafe/unsafe-const-fn.thir.stderr rename tests/ui/unsafe/{unsafe-fn-assign-deref-ptr.mir.stderr => unsafe-fn-assign-deref-ptr.stderr} (90%) delete mode 100644 tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr rename tests/ui/unsafe/{unsafe-fn-called-from-safe.mir.stderr => unsafe-fn-called-from-safe.stderr} (88%) delete mode 100644 tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr rename tests/ui/unsafe/{unsafe-fn-deref-ptr.mir.stderr => unsafe-fn-deref-ptr.stderr} (89%) delete mode 100644 tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr rename tests/ui/unsafe/{unsafe-fn-used-as-value.mir.stderr => unsafe-fn-used-as-value.stderr} (89%) delete mode 100644 tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr rename tests/ui/unsafe/{unsafe-not-inherited.mirunsafeck.stderr => unsafe-not-inherited.stderr} (91%) delete mode 100644 tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr rename tests/ui/unsafe/{unsafe-unstable-const-fn.mir.stderr => unsafe-unstable-const-fn.stderr} (90%) delete mode 100644 tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr rename tests/ui/unsafe/{wrapping-unsafe-block-sugg.mir.fixed => wrapping-unsafe-block-sugg.fixed} (75%) rename tests/ui/unsafe/{wrapping-unsafe-block-sugg.mir.stderr => wrapping-unsafe-block-sugg.stderr} (85%) 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 de299bfdbdfc9..0b02c99abf662 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.rs b/tests/ui/asm/bad-arch.rs index 93309899bf387..3eeb76f3d0035 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.mirunsafeck.stderr b/tests/ui/asm/bad-arch.stderr similarity index 89% rename from tests/ui/asm/bad-arch.mirunsafeck.stderr rename to tests/ui/asm/bad-arch.stderr index d7af296152f79..23aad9908ef02 100644 --- a/tests/ui/asm/bad-arch.mirunsafeck.stderr +++ b/tests/ui/asm/bad-arch.stderr @@ -1,11 +1,11 @@ error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:22:9 + --> $DIR/bad-arch.rs:20:9 | LL | asm!(""); | ^^^^^^^^ error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:27:1 + --> $DIR/bad-arch.rs:25:1 | LL | global_asm!(""); | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/asm/bad-arch.thirunsafeck.stderr b/tests/ui/asm/bad-arch.thirunsafeck.stderr deleted file mode 100644 index d7af296152f79..0000000000000 --- 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_mirunsafeck.stderr b/tests/ui/asm/bad-template.aarch64.stderr similarity index 86% rename from tests/ui/asm/bad-template.aarch64_mirunsafeck.stderr rename to tests/ui/asm/bad-template.aarch64.stderr index b16f9a06c2abe..4ffcd2303b74f 100644 --- a/tests/ui/asm/bad-template.aarch64_mirunsafeck.stderr +++ b/tests/ui/asm/bad-template.aarch64.stderr @@ -1,5 +1,5 @@ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:31:15 + --> $DIR/bad-template.rs:27:15 | LL | asm!("{}"); | ^^ from here @@ -7,7 +7,7 @@ LL | asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:33:15 + --> $DIR/bad-template.rs:29:15 | LL | asm!("{1}", in(reg) foo); | ^^^ from here @@ -15,7 +15,7 @@ LL | asm!("{1}", in(reg) foo); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:33:21 + --> $DIR/bad-template.rs:29:21 | LL | asm!("{1}", in(reg) foo); | ^^^^^^^^^^^ argument never used @@ -23,13 +23,13 @@ LL | asm!("{1}", in(reg) foo); = 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 + --> $DIR/bad-template.rs:32:16 | LL | asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:38:15 + --> $DIR/bad-template.rs:34:15 | LL | asm!("{}", a = in(reg) foo); | ^^ --------------- named argument @@ -38,13 +38,13 @@ LL | asm!("{}", a = in(reg) foo); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:38:20 + --> $DIR/bad-template.rs:34:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:38:20 + --> $DIR/bad-template.rs:34:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -52,7 +52,7 @@ LL | asm!("{}", a = in(reg) foo); = 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 + --> $DIR/bad-template.rs:37:15 | LL | asm!("{1}", a = in(reg) foo); | ^^^ from here @@ -60,7 +60,7 @@ LL | asm!("{1}", a = in(reg) foo); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:41:21 + --> $DIR/bad-template.rs:37:21 | LL | asm!("{1}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -68,7 +68,7 @@ LL | asm!("{1}", a = in(reg) foo); = 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 + --> $DIR/bad-template.rs:44:15 | LL | asm!("{}", in("x0") foo); | ^^ ------------ explicit register argument @@ -77,24 +77,24 @@ LL | asm!("{}", in("x0") foo); | = note: no positional arguments were given note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:48:20 + --> $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:48:20 + --> $DIR/bad-template.rs:44:20 | LL | asm!("{}", in("x0") foo); | ^^^^^^^^^^^^ error: asm template modifier must be a single character - --> $DIR/bad-template.rs:50:17 + --> $DIR/bad-template.rs:46:17 | LL | asm!("{:foo}", in(reg) foo); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:53:18 + --> $DIR/bad-template.rs:49:18 | LL | asm!("", in(reg) 0, in(reg) 1); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -104,7 +104,7 @@ LL | asm!("", in(reg) 0, in(reg) 1); = 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 + --> $DIR/bad-template.rs:55:14 | LL | global_asm!("{}"); | ^^ from here @@ -112,7 +112,7 @@ LL | global_asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:61:14 + --> $DIR/bad-template.rs:57:14 | LL | global_asm!("{1}", const FOO); | ^^^ from here @@ -120,7 +120,7 @@ LL | global_asm!("{1}", const FOO); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:61:20 + --> $DIR/bad-template.rs:57:20 | LL | global_asm!("{1}", const FOO); | ^^^^^^^^^ argument never used @@ -128,13 +128,13 @@ LL | global_asm!("{1}", const FOO); = 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 + --> $DIR/bad-template.rs:60:15 | LL | global_asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:66:14 + --> $DIR/bad-template.rs:62:14 | LL | global_asm!("{}", a = const FOO); | ^^ ------------- named argument @@ -143,13 +143,13 @@ LL | global_asm!("{}", a = const FOO); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:66:19 + --> $DIR/bad-template.rs:62:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:66:19 + --> $DIR/bad-template.rs:62:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -157,7 +157,7 @@ LL | global_asm!("{}", a = const FOO); = 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 + --> $DIR/bad-template.rs:65:14 | LL | global_asm!("{1}", a = const FOO); | ^^^ from here @@ -165,7 +165,7 @@ LL | global_asm!("{1}", a = const FOO); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:69:20 + --> $DIR/bad-template.rs:65:20 | LL | global_asm!("{1}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -173,13 +173,13 @@ LL | global_asm!("{1}", a = const FOO); = 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 + --> $DIR/bad-template.rs:68:16 | LL | global_asm!("{:foo}", const FOO); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:74:17 + --> $DIR/bad-template.rs:70:17 | LL | global_asm!("", const FOO, const FOO); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO); = 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 + --> $DIR/bad-template.rs:46:15 | LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument 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 b16f9a06c2abe..0000000000000 --- 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 556371747920e..a6a233a36ec38 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_mirunsafeck.stderr b/tests/ui/asm/bad-template.x86_64.stderr similarity index 86% rename from tests/ui/asm/bad-template.x86_64_mirunsafeck.stderr rename to tests/ui/asm/bad-template.x86_64.stderr index 41ac37c33c2e0..52a7789b98cc1 100644 --- a/tests/ui/asm/bad-template.x86_64_mirunsafeck.stderr +++ b/tests/ui/asm/bad-template.x86_64.stderr @@ -1,5 +1,5 @@ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:31:15 + --> $DIR/bad-template.rs:27:15 | LL | asm!("{}"); | ^^ from here @@ -7,7 +7,7 @@ LL | asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:33:15 + --> $DIR/bad-template.rs:29:15 | LL | asm!("{1}", in(reg) foo); | ^^^ from here @@ -15,7 +15,7 @@ LL | asm!("{1}", in(reg) foo); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:33:21 + --> $DIR/bad-template.rs:29:21 | LL | asm!("{1}", in(reg) foo); | ^^^^^^^^^^^ argument never used @@ -23,13 +23,13 @@ LL | asm!("{1}", in(reg) foo); = 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 + --> $DIR/bad-template.rs:32:16 | LL | asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:38:15 + --> $DIR/bad-template.rs:34:15 | LL | asm!("{}", a = in(reg) foo); | ^^ --------------- named argument @@ -38,13 +38,13 @@ LL | asm!("{}", a = in(reg) foo); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:38:20 + --> $DIR/bad-template.rs:34:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:38:20 + --> $DIR/bad-template.rs:34:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -52,7 +52,7 @@ LL | asm!("{}", a = in(reg) foo); = 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 + --> $DIR/bad-template.rs:37:15 | LL | asm!("{1}", a = in(reg) foo); | ^^^ from here @@ -60,7 +60,7 @@ LL | asm!("{1}", a = in(reg) foo); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:41:21 + --> $DIR/bad-template.rs:37:21 | LL | asm!("{1}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -68,7 +68,7 @@ LL | asm!("{1}", a = in(reg) foo); = 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 + --> $DIR/bad-template.rs:41:15 | LL | asm!("{}", in("eax") foo); | ^^ ------------- explicit register argument @@ -77,24 +77,24 @@ LL | asm!("{}", in("eax") foo); | = note: no positional arguments were given note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:45:20 + --> $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:45:20 + --> $DIR/bad-template.rs:41:20 | LL | asm!("{}", in("eax") foo); | ^^^^^^^^^^^^^ error: asm template modifier must be a single character - --> $DIR/bad-template.rs:50:17 + --> $DIR/bad-template.rs:46:17 | LL | asm!("{:foo}", in(reg) foo); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:53:18 + --> $DIR/bad-template.rs:49:18 | LL | asm!("", in(reg) 0, in(reg) 1); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -104,7 +104,7 @@ LL | asm!("", in(reg) 0, in(reg) 1); = 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 + --> $DIR/bad-template.rs:55:14 | LL | global_asm!("{}"); | ^^ from here @@ -112,7 +112,7 @@ LL | global_asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:61:14 + --> $DIR/bad-template.rs:57:14 | LL | global_asm!("{1}", const FOO); | ^^^ from here @@ -120,7 +120,7 @@ LL | global_asm!("{1}", const FOO); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:61:20 + --> $DIR/bad-template.rs:57:20 | LL | global_asm!("{1}", const FOO); | ^^^^^^^^^ argument never used @@ -128,13 +128,13 @@ LL | global_asm!("{1}", const FOO); = 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 + --> $DIR/bad-template.rs:60:15 | LL | global_asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:66:14 + --> $DIR/bad-template.rs:62:14 | LL | global_asm!("{}", a = const FOO); | ^^ ------------- named argument @@ -143,13 +143,13 @@ LL | global_asm!("{}", a = const FOO); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:66:19 + --> $DIR/bad-template.rs:62:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:66:19 + --> $DIR/bad-template.rs:62:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -157,7 +157,7 @@ LL | global_asm!("{}", a = const FOO); = 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 + --> $DIR/bad-template.rs:65:14 | LL | global_asm!("{1}", a = const FOO); | ^^^ from here @@ -165,7 +165,7 @@ LL | global_asm!("{1}", a = const FOO); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:69:20 + --> $DIR/bad-template.rs:65:20 | LL | global_asm!("{1}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -173,13 +173,13 @@ LL | global_asm!("{1}", a = const FOO); = 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 + --> $DIR/bad-template.rs:68:16 | LL | global_asm!("{:foo}", const FOO); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:74:17 + --> $DIR/bad-template.rs:70:17 | LL | global_asm!("", const FOO, const FOO); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO); = 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 + --> $DIR/bad-template.rs:46:15 | LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument 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 41ac37c33c2e0..0000000000000 --- 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 d523ae021a5d4..f9a2ab6269fa2 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 9cabf16f8bba9..63941a7913948 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.rs b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs index 14cc0dc614fc3..f7e9e96bff700 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.mir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr similarity index 88% rename from tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr rename to tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr index f9e5bf675cbd9..89c496c598d1c 100644 --- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr +++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:12:5 | LL | S::f(); | ^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | S::f(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | LL | f(); | ^^^ call to unsafe function @@ -15,7 +15,7 @@ LL | f(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 | LL | S::f(); | ^^^^^^ call to unsafe function @@ -23,7 +23,7 @@ LL | S::f(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5 + --> $DIR/async-unsafe-fn-call-in-safe.rs:21:5 | LL | f(); | ^^^ call to unsafe function 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 ba3303fe7939e..0000000000000 --- 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.rs b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.rs index bdb3eb23c38f8..76a0f2914103d 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.mir.stderr b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr similarity index 86% rename from tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr rename to tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr index 2f9c7973b5a16..190b4792ebcbc 100644 --- a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.mir.stderr +++ b/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:12:23 | LL | let result: i32 = foo(5, 5); | ^^^^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | let result: i32 = foo(5, 5); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 + --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:21:23 | LL | let result: i32 = foo(5, 5); | ^^^^^^^^^ call to unsafe function 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 57358fbdd8404..36777693faba0 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.mir.stderr b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr similarity index 89% rename from tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr rename to tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr index 579227703103a..75c379c88e3d8 100644 --- a/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr +++ b/tests/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31 + --> $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 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 fb237231d65a7..0000000000000 --- 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 aea539b74dffc..a4a487c4dc2e8 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 d366c5ffbfd8c..e8a909eecc14a 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 6c4f0a5accf99..896d4b376fdae 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/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr similarity index 61% rename from tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr rename to tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr index 2f9c7973b5a16..5196b8ee0a21d 100644 --- a/tests/ui/closures/closure_no_cap_coerce_many_unsafe_0.thir.stderr +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr @@ -1,16 +1,16 @@ 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 + --> $DIR/const-extern-fn-requires-unsafe.rs:8:5 | -LL | let result: i32 = foo(5, 5); - | ^^^^^^^^^ call to unsafe function +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/closure_no_cap_coerce_many_unsafe_0.rs:24:23 + --> $DIR/const-extern-fn-requires-unsafe.rs:6:17 | -LL | let result: i32 = foo(5, 5); - | ^^^^^^^^^ call to unsafe function +LL | let a: [u8; foo()]; + | ^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/tests/ui/consts/issue-16538.rs b/tests/ui/consts/issue-16538.rs index 270fa30141427..31f334fb4054e 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.mir.stderr b/tests/ui/consts/issue-16538.stderr similarity index 93% rename from tests/ui/consts/issue-16538.mir.stderr rename to tests/ui/consts/issue-16538.stderr index e320df4b7ad8f..afb344f5e857b 100644 --- a/tests/ui/consts/issue-16538.mir.stderr +++ b/tests/ui/consts/issue-16538.stderr @@ -1,5 +1,5 @@ error[E0015]: cannot call non-const fn `Y::foo` in statics - --> $DIR/issue-16538.rs:14:23 + --> $DIR/issue-16538.rs:11:23 | LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); = 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 + --> $DIR/issue-16538.rs:11:30 | LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ^^^^ use of extern static @@ -16,7 +16,7 @@ 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:14:21 + --> $DIR/issue-16538.rs:11:21 | LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer diff --git a/tests/ui/consts/issue-16538.thir.stderr b/tests/ui/consts/issue-16538.thir.stderr deleted file mode 100644 index 4a862869274f8..0000000000000 --- 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.rs b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs index 7961b58597c4a..dab9c81bc8fe8 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.mir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr similarity index 90% rename from tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr rename to tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr index 11dc57bcf4673..d0f200b83609d 100644 --- a/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr +++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9 + --> $DIR/issue-45729-unsafe-in-coroutine.rs:5:9 | LL | *(1 as *mut u32) = 42; | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer 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 a61689a0df51e..0000000000000 --- 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 07f810856a72f..0ed849e0e7d10 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.rs b/tests/ui/error-codes/E0133.rs index dee1475ba213a..52494ce6078c4 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.mir.stderr b/tests/ui/error-codes/E0133.stderr similarity index 93% rename from tests/ui/error-codes/E0133.mir.stderr rename to tests/ui/error-codes/E0133.stderr index f8703ef06335f..a1ae6cb7fc903 100644 --- a/tests/ui/error-codes/E0133.mir.stderr +++ b/tests/ui/error-codes/E0133.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/E0133.rs:7:5 + --> $DIR/E0133.rs:4:5 | LL | f(); | ^^^ call to unsafe function diff --git a/tests/ui/error-codes/E0133.thir.stderr b/tests/ui/error-codes/E0133.thir.stderr deleted file mode 100644 index fd4d42bcb8b62..0000000000000 --- 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.rs b/tests/ui/extern/issue-28324.rs index fbe83e325edb4..f74726e8166dc 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.mir.stderr b/tests/ui/extern/issue-28324.stderr similarity index 93% rename from tests/ui/extern/issue-28324.mir.stderr rename to tests/ui/extern/issue-28324.stderr index 9376ac35e2154..be748b47d4d16 100644 --- a/tests/ui/extern/issue-28324.mir.stderr +++ b/tests/ui/extern/issue-28324.stderr @@ -1,5 +1,5 @@ error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28324.rs:8:24 + --> $DIR/issue-28324.rs:5:24 | LL | pub static BAZ: u32 = *&error_message_count; | ^^^^^^^^^^^^^^^^^^^^ use of extern static diff --git a/tests/ui/extern/issue-28324.thir.stderr b/tests/ui/extern/issue-28324.thir.stderr deleted file mode 100644 index 8857f379ad189..0000000000000 --- 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.rs b/tests/ui/inline-const/expr-unsafe-err.rs index adf05d352ea70..a05a294516833 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.mir.stderr b/tests/ui/inline-const/expr-unsafe-err.stderr similarity index 100% rename from tests/ui/inline-const/expr-unsafe-err.mir.stderr rename to tests/ui/inline-const/expr-unsafe-err.stderr 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 45f850d1f99bf..0000000000000 --- 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.rs b/tests/ui/inline-const/expr-unsafe.rs index d71efd33db163..2370c58a71206 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.mir.stderr b/tests/ui/inline-const/expr-unsafe.stderr similarity index 80% rename from tests/ui/inline-const/expr-unsafe.mir.stderr rename to tests/ui/inline-const/expr-unsafe.stderr index 1ab6e42fba0a5..47334aaab8355 100644 --- a/tests/ui/inline-const/expr-unsafe.mir.stderr +++ b/tests/ui/inline-const/expr-unsafe.stderr @@ -1,11 +1,11 @@ warning: unnecessary `unsafe` block - --> $DIR/expr-unsafe.rs:12:13 + --> $DIR/expr-unsafe.rs:11:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/expr-unsafe.rs:4:9 + --> $DIR/expr-unsafe.rs:3:9 | LL | #![warn(unused_unsafe)] | ^^^^^^^^^^^^^ 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 1ab6e42fba0a5..0000000000000 --- 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 6df281c6d945e..0db18dd3260d0 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 48a2cb4c704d5..0000000000000 --- 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 36f8632af6738..cfef9ad6a563e 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 0318b3ff2cc6a..0000000000000 --- 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.rs b/tests/ui/intrinsics/issue-28575.rs index 410f664f89d44..141136d25b215 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.mir.stderr b/tests/ui/intrinsics/issue-28575.stderr similarity index 92% rename from tests/ui/intrinsics/issue-28575.mir.stderr rename to tests/ui/intrinsics/issue-28575.stderr index 4b29b4c1b6a9a..8a7816f231f70 100644 --- a/tests/ui/intrinsics/issue-28575.mir.stderr +++ b/tests/ui/intrinsics/issue-28575.stderr @@ -1,5 +1,5 @@ error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28575.rs:11:5 + --> $DIR/issue-28575.rs:8:5 | LL | FOO() | ^^^ use of extern static diff --git a/tests/ui/intrinsics/issue-28575.thir.stderr b/tests/ui/intrinsics/issue-28575.thir.stderr deleted file mode 100644 index 4b29b4c1b6a9a..0000000000000 --- 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.rs b/tests/ui/intrinsics/unchecked_math_unsafe.rs index 98d3a11ad0276..a034b45f5308c 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.mir.stderr b/tests/ui/intrinsics/unchecked_math_unsafe.stderr similarity index 89% rename from tests/ui/intrinsics/unchecked_math_unsafe.mir.stderr rename to tests/ui/intrinsics/unchecked_math_unsafe.stderr index 26b2f9f271311..4066cf8efb8c1 100644 --- a/tests/ui/intrinsics/unchecked_math_unsafe.mir.stderr +++ b/tests/ui/intrinsics/unchecked_math_unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:8:15 + --> $DIR/unchecked_math_unsafe.rs:5:15 | LL | let add = std::intrinsics::unchecked_add(x, y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | let add = std::intrinsics::unchecked_add(x, y); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:9:15 + --> $DIR/unchecked_math_unsafe.rs:6:15 | LL | let sub = std::intrinsics::unchecked_sub(x, y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -15,7 +15,7 @@ LL | let sub = std::intrinsics::unchecked_sub(x, y); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unchecked_math_unsafe.rs:10:15 + --> $DIR/unchecked_math_unsafe.rs:7:15 | LL | let mul = std::intrinsics::unchecked_mul(x, y); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function 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 5c3728ccdf843..0000000000000 --- 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 fa80f509b3229..c3badfd9b4904 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.rs b/tests/ui/issues/issue-28776.rs index 19df3c4a4252b..e564ebcd110cb 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.mir.stderr b/tests/ui/issues/issue-28776.stderr similarity index 93% rename from tests/ui/issues/issue-28776.mir.stderr rename to tests/ui/issues/issue-28776.stderr index e7b7ba082688c..9f0f10335abbe 100644 --- a/tests/ui/issues/issue-28776.mir.stderr +++ b/tests/ui/issues/issue-28776.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-28776.rs:7:5 + --> $DIR/issue-28776.rs:4:5 | LL | (&ptr::write)(1 as *mut _, 42); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/issues/issue-28776.thir.stderr b/tests/ui/issues/issue-28776.thir.stderr deleted file mode 100644 index 63172b85424df..0000000000000 --- 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 e7beb8a0392e8..039b47ae78078 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 6817e8830c509..0000000000000 --- 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 df98547084d69..85664e62eaded 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.thir.stderr b/tests/ui/issues/issue-48131.stderr similarity index 81% rename from tests/ui/issues/issue-48131.thir.stderr rename to tests/ui/issues/issue-48131.stderr index 6817e8830c509..5acc4f16e9fc2 100644 --- a/tests/ui/issues/issue-48131.thir.stderr +++ b/tests/ui/issues/issue-48131.stderr @@ -1,17 +1,17 @@ error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:12:9 + --> $DIR/issue-48131.rs:9:9 | LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/issue-48131.rs:6:9 + --> $DIR/issue-48131.rs:3:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:23:13 + --> $DIR/issue-48131.rs:20:13 | LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/issues/issue-5844.rs b/tests/ui/issues/issue-5844.rs index 4f90a9c66451f..0db1ccf76d992 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.mir.stderr b/tests/ui/issues/issue-5844.stderr similarity index 93% rename from tests/ui/issues/issue-5844.mir.stderr rename to tests/ui/issues/issue-5844.stderr index 4434f5a0ff254..af7bfb0332029 100644 --- a/tests/ui/issues/issue-5844.mir.stderr +++ b/tests/ui/issues/issue-5844.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:8:5 + --> $DIR/issue-5844.rs:6:5 | LL | issue_5844_aux::rand(); | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/issues/issue-5844.thir.stderr b/tests/ui/issues/issue-5844.thir.stderr deleted file mode 100644 index 6074f7d0ed4ef..0000000000000 --- 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 1c7368b36e135..635ad783b3155 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 7a9e5b7e02ea0..0000000000000 --- 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 fb7779fa80881..b4f19bb829407 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 0000000000000..4a6990da56f6d --- /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 7a9e5b7e02ea0..0000000000000 --- 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 24985386a97a1..68e6fa838b4e2 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 e0842bfa4cde4..58a2c271ecfbc 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 a59d7c2d784c7..fefe100ba0ee1 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 c95d4a08e48bb..3ecea5c531390 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 0000000000000..cc941be5479e3 --- /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 bc886400099a5..115f00b3f4e10 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 f17dab269bc4b..b420d14d1e175 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 0000000000000..3897f09b57661 --- /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 c575a6bec8e92..c321e86dc1821 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 da5c42a1a9888..103132c18ae2f 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.rs b/tests/ui/span/lint-unused-unsafe.rs index ca615f64f2230..94bdd11400717 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.mir.stderr b/tests/ui/span/lint-unused-unsafe.stderr similarity index 83% rename from tests/ui/span/lint-unused-unsafe.mir.stderr rename to tests/ui/span/lint-unused-unsafe.stderr index 9e8d3359242ff..d8bd7cc747538 100644 --- a/tests/ui/span/lint-unused-unsafe.mir.stderr +++ b/tests/ui/span/lint-unused-unsafe.stderr @@ -1,77 +1,77 @@ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:22:13 + --> $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:10:9 + --> $DIR/lint-unused-unsafe.rs:7:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:23:13 + --> $DIR/lint-unused-unsafe.rs:20:13 | LL | fn bad2() { unsafe { bad1() } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:24:20 + --> $DIR/lint-unused-unsafe.rs:21:20 | LL | unsafe fn bad3() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:25:13 + --> $DIR/lint-unused-unsafe.rs:22:13 | LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:5 + --> $DIR/lint-unused-unsafe.rs:25:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:35:5 + --> $DIR/lint-unused-unsafe.rs:32:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:70:9 + --> $DIR/lint-unused-unsafe.rs:67:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:79:9 + --> $DIR/lint-unused-unsafe.rs:76:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:80:13 + --> $DIR/lint-unused-unsafe.rs:77:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:81:13 + --> $DIR/lint-unused-unsafe.rs:78:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:86:9 + --> $DIR/lint-unused-unsafe.rs:83:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:96:13 + --> $DIR/lint-unused-unsafe.rs:93:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -80,7 +80,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:97:13 + --> $DIR/lint-unused-unsafe.rs:94:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -89,7 +89,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:98:13 + --> $DIR/lint-unused-unsafe.rs:95:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -98,7 +98,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:108:17 + --> $DIR/lint-unused-unsafe.rs:105:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -107,13 +107,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:106:20 + --> $DIR/lint-unused-unsafe.rs:103:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:109:17 + --> $DIR/lint-unused-unsafe.rs:106:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -122,7 +122,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:110:17 + --> $DIR/lint-unused-unsafe.rs:107:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -131,37 +131,37 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:120:9 + --> $DIR/lint-unused-unsafe.rs:117:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:130:9 + --> $DIR/lint-unused-unsafe.rs:127:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:131:13 + --> $DIR/lint-unused-unsafe.rs:128:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:132:13 + --> $DIR/lint-unused-unsafe.rs:129:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:138:9 + --> $DIR/lint-unused-unsafe.rs:135:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:149:13 + --> $DIR/lint-unused-unsafe.rs:146:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -170,7 +170,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:150:13 + --> $DIR/lint-unused-unsafe.rs:147:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -179,7 +179,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:151:13 + --> $DIR/lint-unused-unsafe.rs:148:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -188,7 +188,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:162:17 + --> $DIR/lint-unused-unsafe.rs:159:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -197,13 +197,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:160:20 + --> $DIR/lint-unused-unsafe.rs:157:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:163:17 + --> $DIR/lint-unused-unsafe.rs:160:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -212,7 +212,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:164:17 + --> $DIR/lint-unused-unsafe.rs:161:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -221,37 +221,37 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:174:9 + --> $DIR/lint-unused-unsafe.rs:171:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:184:9 + --> $DIR/lint-unused-unsafe.rs:181:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:185:13 + --> $DIR/lint-unused-unsafe.rs:182:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:186:13 + --> $DIR/lint-unused-unsafe.rs:183:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:192:9 + --> $DIR/lint-unused-unsafe.rs:189:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:203:13 + --> $DIR/lint-unused-unsafe.rs:200:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -260,7 +260,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:204:13 + --> $DIR/lint-unused-unsafe.rs:201:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -269,7 +269,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:205:13 + --> $DIR/lint-unused-unsafe.rs:202:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -278,7 +278,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:216:17 + --> $DIR/lint-unused-unsafe.rs:213:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -287,13 +287,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:214:20 + --> $DIR/lint-unused-unsafe.rs:211:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:217:17 + --> $DIR/lint-unused-unsafe.rs:214:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -302,7 +302,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:218:17 + --> $DIR/lint-unused-unsafe.rs:215:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -311,13 +311,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:238:9 + --> $DIR/lint-unused-unsafe.rs:235:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:251:13 + --> $DIR/lint-unused-unsafe.rs:248:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -325,7 +325,7 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:264:13 + --> $DIR/lint-unused-unsafe.rs:261:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -333,37 +333,37 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:282:20 + --> $DIR/lint-unused-unsafe.rs:279:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:291:20 + --> $DIR/lint-unused-unsafe.rs:288:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:292:24 + --> $DIR/lint-unused-unsafe.rs:289:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:293:24 + --> $DIR/lint-unused-unsafe.rs:290:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:298:20 + --> $DIR/lint-unused-unsafe.rs:295:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:308:24 + --> $DIR/lint-unused-unsafe.rs:305:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -372,7 +372,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:309:24 + --> $DIR/lint-unused-unsafe.rs:306:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -381,7 +381,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:310:24 + --> $DIR/lint-unused-unsafe.rs:307:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -390,7 +390,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:320:28 + --> $DIR/lint-unused-unsafe.rs:317:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -399,13 +399,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:318:20 + --> $DIR/lint-unused-unsafe.rs:315:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:321:28 + --> $DIR/lint-unused-unsafe.rs:318:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -414,7 +414,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:322:28 + --> $DIR/lint-unused-unsafe.rs:319:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -423,37 +423,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:332:20 + --> $DIR/lint-unused-unsafe.rs:329:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:342:20 + --> $DIR/lint-unused-unsafe.rs:339:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:343:24 + --> $DIR/lint-unused-unsafe.rs:340:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:344:24 + --> $DIR/lint-unused-unsafe.rs:341:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:350:20 + --> $DIR/lint-unused-unsafe.rs:347:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:361:24 + --> $DIR/lint-unused-unsafe.rs:358:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -462,7 +462,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:362:24 + --> $DIR/lint-unused-unsafe.rs:359:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -471,7 +471,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:363:24 + --> $DIR/lint-unused-unsafe.rs:360:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -480,7 +480,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:374:28 + --> $DIR/lint-unused-unsafe.rs:371:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -489,13 +489,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:372:20 + --> $DIR/lint-unused-unsafe.rs:369:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:375:28 + --> $DIR/lint-unused-unsafe.rs:372:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -504,7 +504,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:376:28 + --> $DIR/lint-unused-unsafe.rs:373:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -513,37 +513,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:386:20 + --> $DIR/lint-unused-unsafe.rs:383:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:396:20 + --> $DIR/lint-unused-unsafe.rs:393:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:397:24 + --> $DIR/lint-unused-unsafe.rs:394:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:398:24 + --> $DIR/lint-unused-unsafe.rs:395:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:404:20 + --> $DIR/lint-unused-unsafe.rs:401:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:415:24 + --> $DIR/lint-unused-unsafe.rs:412:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -552,7 +552,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:416:24 + --> $DIR/lint-unused-unsafe.rs:413:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -561,7 +561,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:417:24 + --> $DIR/lint-unused-unsafe.rs:414:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -570,7 +570,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:428:28 + --> $DIR/lint-unused-unsafe.rs:425:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -579,13 +579,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:426:20 + --> $DIR/lint-unused-unsafe.rs:423:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:429:28 + --> $DIR/lint-unused-unsafe.rs:426:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -594,7 +594,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:430:28 + --> $DIR/lint-unused-unsafe.rs:427:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -603,13 +603,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:450:20 + --> $DIR/lint-unused-unsafe.rs:447:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:463:24 + --> $DIR/lint-unused-unsafe.rs:460:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -617,7 +617,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:476:24 + --> $DIR/lint-unused-unsafe.rs:473:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -625,37 +625,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:495:20 + --> $DIR/lint-unused-unsafe.rs:492:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:504:20 + --> $DIR/lint-unused-unsafe.rs:501:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:505:24 + --> $DIR/lint-unused-unsafe.rs:502:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:506:24 + --> $DIR/lint-unused-unsafe.rs:503:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:511:20 + --> $DIR/lint-unused-unsafe.rs:508:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:521:24 + --> $DIR/lint-unused-unsafe.rs:518:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -664,7 +664,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:522:24 + --> $DIR/lint-unused-unsafe.rs:519:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -673,7 +673,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:523:24 + --> $DIR/lint-unused-unsafe.rs:520:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -682,7 +682,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:533:28 + --> $DIR/lint-unused-unsafe.rs:530:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -691,13 +691,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:531:20 + --> $DIR/lint-unused-unsafe.rs:528:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:534:28 + --> $DIR/lint-unused-unsafe.rs:531:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -706,7 +706,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:535:28 + --> $DIR/lint-unused-unsafe.rs:532:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -715,37 +715,37 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:545:20 + --> $DIR/lint-unused-unsafe.rs:542:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:555:20 + --> $DIR/lint-unused-unsafe.rs:552:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:556:24 + --> $DIR/lint-unused-unsafe.rs:553:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:557:24 + --> $DIR/lint-unused-unsafe.rs:554:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:563:20 + --> $DIR/lint-unused-unsafe.rs:560:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:574:24 + --> $DIR/lint-unused-unsafe.rs:571:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -754,7 +754,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:575:24 + --> $DIR/lint-unused-unsafe.rs:572:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -763,7 +763,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:576:24 + --> $DIR/lint-unused-unsafe.rs:573:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -772,7 +772,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:587:28 + --> $DIR/lint-unused-unsafe.rs:584:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -781,13 +781,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:585:20 + --> $DIR/lint-unused-unsafe.rs:582:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:588:28 + --> $DIR/lint-unused-unsafe.rs:585:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -796,7 +796,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:589:28 + --> $DIR/lint-unused-unsafe.rs:586:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -805,37 +805,37 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:599:20 + --> $DIR/lint-unused-unsafe.rs:596:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:609:20 + --> $DIR/lint-unused-unsafe.rs:606:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:610:24 + --> $DIR/lint-unused-unsafe.rs:607:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:611:24 + --> $DIR/lint-unused-unsafe.rs:608:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:617:20 + --> $DIR/lint-unused-unsafe.rs:614:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:628:24 + --> $DIR/lint-unused-unsafe.rs:625:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -844,7 +844,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:629:24 + --> $DIR/lint-unused-unsafe.rs:626:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -853,7 +853,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:630:24 + --> $DIR/lint-unused-unsafe.rs:627:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -862,7 +862,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:641:28 + --> $DIR/lint-unused-unsafe.rs:638:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -871,13 +871,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:639:20 + --> $DIR/lint-unused-unsafe.rs:636:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:642:28 + --> $DIR/lint-unused-unsafe.rs:639:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -886,7 +886,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:643:28 + --> $DIR/lint-unused-unsafe.rs:640:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -895,13 +895,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:663:20 + --> $DIR/lint-unused-unsafe.rs:660:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:676:24 + --> $DIR/lint-unused-unsafe.rs:673:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -909,7 +909,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:689:24 + --> $DIR/lint-unused-unsafe.rs:686:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -917,37 +917,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:707:24 + --> $DIR/lint-unused-unsafe.rs:704:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:717:24 + --> $DIR/lint-unused-unsafe.rs:714:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:718:28 + --> $DIR/lint-unused-unsafe.rs:715:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:719:28 + --> $DIR/lint-unused-unsafe.rs:716:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:725:24 + --> $DIR/lint-unused-unsafe.rs:722:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:736:28 + --> $DIR/lint-unused-unsafe.rs:733:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -956,7 +956,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:737:28 + --> $DIR/lint-unused-unsafe.rs:734:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -965,7 +965,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:738:28 + --> $DIR/lint-unused-unsafe.rs:735:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -974,7 +974,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:749:32 + --> $DIR/lint-unused-unsafe.rs:746:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -983,13 +983,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:747:24 + --> $DIR/lint-unused-unsafe.rs:744:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:750:32 + --> $DIR/lint-unused-unsafe.rs:747:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -998,7 +998,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:751:32 + --> $DIR/lint-unused-unsafe.rs:748:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1007,37 +1007,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:761:24 + --> $DIR/lint-unused-unsafe.rs:758:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:771:24 + --> $DIR/lint-unused-unsafe.rs:768:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:772:28 + --> $DIR/lint-unused-unsafe.rs:769:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:773:28 + --> $DIR/lint-unused-unsafe.rs:770:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:779:24 + --> $DIR/lint-unused-unsafe.rs:776:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:790:28 + --> $DIR/lint-unused-unsafe.rs:787:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1046,7 +1046,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:791:28 + --> $DIR/lint-unused-unsafe.rs:788:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1055,7 +1055,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:792:28 + --> $DIR/lint-unused-unsafe.rs:789:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1064,7 +1064,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:803:32 + --> $DIR/lint-unused-unsafe.rs:800:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1073,13 +1073,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:801:24 + --> $DIR/lint-unused-unsafe.rs:798:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:804:32 + --> $DIR/lint-unused-unsafe.rs:801:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1088,7 +1088,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:805:32 + --> $DIR/lint-unused-unsafe.rs:802:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1097,13 +1097,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:825:24 + --> $DIR/lint-unused-unsafe.rs:822:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:838:28 + --> $DIR/lint-unused-unsafe.rs:835:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1111,7 +1111,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:851:28 + --> $DIR/lint-unused-unsafe.rs:848:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1119,37 +1119,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:865:24 + --> $DIR/lint-unused-unsafe.rs:862:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:875:24 + --> $DIR/lint-unused-unsafe.rs:872:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:876:28 + --> $DIR/lint-unused-unsafe.rs:873:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:877:28 + --> $DIR/lint-unused-unsafe.rs:874:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:883:24 + --> $DIR/lint-unused-unsafe.rs:880:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:894:28 + --> $DIR/lint-unused-unsafe.rs:891:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1158,7 +1158,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:895:28 + --> $DIR/lint-unused-unsafe.rs:892:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1167,7 +1167,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:896:28 + --> $DIR/lint-unused-unsafe.rs:893:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1176,7 +1176,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:907:32 + --> $DIR/lint-unused-unsafe.rs:904:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1185,13 +1185,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:905:24 + --> $DIR/lint-unused-unsafe.rs:902:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:908:32 + --> $DIR/lint-unused-unsafe.rs:905:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1200,7 +1200,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:909:32 + --> $DIR/lint-unused-unsafe.rs:906:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1209,37 +1209,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:919:24 + --> $DIR/lint-unused-unsafe.rs:916:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:929:24 + --> $DIR/lint-unused-unsafe.rs:926:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:930:28 + --> $DIR/lint-unused-unsafe.rs:927:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:931:28 + --> $DIR/lint-unused-unsafe.rs:928:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:937:24 + --> $DIR/lint-unused-unsafe.rs:934:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:948:28 + --> $DIR/lint-unused-unsafe.rs:945:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1248,7 +1248,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:949:28 + --> $DIR/lint-unused-unsafe.rs:946:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1257,7 +1257,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:950:28 + --> $DIR/lint-unused-unsafe.rs:947:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1266,7 +1266,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:961:32 + --> $DIR/lint-unused-unsafe.rs:958:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1275,13 +1275,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:959:24 + --> $DIR/lint-unused-unsafe.rs:956:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:962:32 + --> $DIR/lint-unused-unsafe.rs:959:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1290,7 +1290,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:963:32 + --> $DIR/lint-unused-unsafe.rs:960:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1299,13 +1299,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:983:24 + --> $DIR/lint-unused-unsafe.rs:980:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:996:28 + --> $DIR/lint-unused-unsafe.rs:993:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1313,7 +1313,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1009:28 + --> $DIR/lint-unused-unsafe.rs:1006:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1321,13 +1321,13 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1055:29 + --> $DIR/lint-unused-unsafe.rs:1052:29 | LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1062:33 + --> $DIR/lint-unused-unsafe.rs:1059:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1336,7 +1336,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1063:33 + --> $DIR/lint-unused-unsafe.rs:1060:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1345,7 +1345,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1064:33 + --> $DIR/lint-unused-unsafe.rs:1061:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1354,13 +1354,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1069:29 + --> $DIR/lint-unused-unsafe.rs:1066:29 | LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1076:33 + --> $DIR/lint-unused-unsafe.rs:1073:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1369,7 +1369,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1077:33 + --> $DIR/lint-unused-unsafe.rs:1074:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1378,7 +1378,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1078:33 + --> $DIR/lint-unused-unsafe.rs:1075:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1387,13 +1387,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1088:22 + --> $DIR/lint-unused-unsafe.rs:1085:22 | LL | let _x: [(); unsafe { 0 }] = []; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1092:22 + --> $DIR/lint-unused-unsafe.rs:1089:22 | LL | let _x: [(); unsafe { unsafe { size() } }] = []; | ^^^^^^ unnecessary `unsafe` block 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 9e8d3359242ff..0000000000000 --- 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.rs b/tests/ui/static/safe-extern-statics-mut.rs index 389a4589a7135..324fa443aa50e 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.mir.stderr b/tests/ui/static/safe-extern-statics-mut.stderr similarity index 87% rename from tests/ui/static/safe-extern-statics-mut.mir.stderr rename to tests/ui/static/safe-extern-statics-mut.stderr index cec5f9d9c9f93..3880388341445 100644 --- a/tests/ui/static/safe-extern-statics-mut.mir.stderr +++ b/tests/ui/static/safe-extern-statics-mut.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:13:13 + --> $DIR/safe-extern-statics-mut.rs:11:13 | LL | let b = B; | ^ use of mutable static @@ -7,7 +7,7 @@ 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:14:14 + --> $DIR/safe-extern-statics-mut.rs:12:14 | LL | let rb = &B; | ^^ use of mutable static @@ -15,7 +15,7 @@ LL | let rb = &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:15:14 + --> $DIR/safe-extern-statics-mut.rs:13:14 | LL | let xb = XB; | ^^ use of mutable static @@ -23,7 +23,7 @@ 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:16:15 + --> $DIR/safe-extern-statics-mut.rs:14:15 | LL | let xrb = &XB; | ^^^ use of mutable static 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 8e6d2805a0ba4..0000000000000 --- 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.rs b/tests/ui/static/safe-extern-statics.rs index 0aa90c442ea75..6fa4c4aaca578 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.mir.stderr b/tests/ui/static/safe-extern-statics.stderr similarity index 89% rename from tests/ui/static/safe-extern-statics.mir.stderr rename to tests/ui/static/safe-extern-statics.stderr index 102abd0816fec..b42572ea3eeb5 100644 --- a/tests/ui/static/safe-extern-statics.mir.stderr +++ b/tests/ui/static/safe-extern-statics.stderr @@ -1,5 +1,5 @@ error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:13:13 + --> $DIR/safe-extern-statics.rs:11:13 | LL | let a = A; | ^ use of extern static @@ -7,7 +7,7 @@ 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:14:14 + --> $DIR/safe-extern-statics.rs:12:14 | LL | let ra = &A; | ^^ use of extern static @@ -15,7 +15,7 @@ LL | let ra = &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:15:14 + --> $DIR/safe-extern-statics.rs:13:14 | LL | let xa = XA; | ^^ use of extern static @@ -23,7 +23,7 @@ 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:16:15 + --> $DIR/safe-extern-statics.rs:14:15 | LL | let xra = &XA; | ^^^ use of extern static 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 7fd2182c4c693..0000000000000 --- 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.rs b/tests/ui/static/static-mut-foreign-requires-unsafe.rs index 4f96acb3375b8..90aa2537a82bb 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.mir.stderr b/tests/ui/static/static-mut-foreign-requires-unsafe.stderr similarity index 85% rename from tests/ui/static/static-mut-foreign-requires-unsafe.mir.stderr rename to tests/ui/static/static-mut-foreign-requires-unsafe.stderr index a4659bc8712fa..e7ed0b710b2f3 100644 --- a/tests/ui/static/static-mut-foreign-requires-unsafe.mir.stderr +++ b/tests/ui/static/static-mut-foreign-requires-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:9:5 + --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5 | LL | a += 3; | ^^^^^^ use of mutable static @@ -7,7 +7,7 @@ LL | a += 3; = 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 + --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5 | LL | a = 4; | ^^^^^ use of mutable static @@ -15,7 +15,7 @@ LL | a = 4; = 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 + --> $DIR/static-mut-foreign-requires-unsafe.rs:8:14 | LL | let _b = a; | ^ use of mutable static 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 2c62d4d8f3bb1..0000000000000 --- 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.rs b/tests/ui/static/static-mut-requires-unsafe.rs index ea3ba0950079e..413b97e431d30 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.mir.stderr b/tests/ui/static/static-mut-requires-unsafe.stderr similarity index 87% rename from tests/ui/static/static-mut-requires-unsafe.mir.stderr rename to tests/ui/static/static-mut-requires-unsafe.stderr index 0d4ce056fc28a..85e468b333c28 100644 --- a/tests/ui/static/static-mut-requires-unsafe.mir.stderr +++ b/tests/ui/static/static-mut-requires-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:7:5 + --> $DIR/static-mut-requires-unsafe.rs:4:5 | LL | a += 3; | ^^^^^^ use of mutable static @@ -7,7 +7,7 @@ LL | a += 3; = 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 + --> $DIR/static-mut-requires-unsafe.rs:5:5 | LL | a = 4; | ^^^^^ use of mutable static @@ -15,7 +15,7 @@ LL | a = 4; = 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 + --> $DIR/static-mut-requires-unsafe.rs:6:14 | LL | let _b = a; | ^ use of mutable static 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 1a1cf14271a98..0000000000000 --- 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.rs b/tests/ui/statics/issue-14227.rs index 5f866ec906144..a1fde14600a10 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.mir.stderr b/tests/ui/statics/issue-14227.stderr similarity index 93% rename from tests/ui/statics/issue-14227.mir.stderr rename to tests/ui/statics/issue-14227.stderr index ab50b97d63f4f..085d6df9c41b2 100644 --- a/tests/ui/statics/issue-14227.mir.stderr +++ b/tests/ui/statics/issue-14227.stderr @@ -1,5 +1,5 @@ error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-14227.rs:7:21 + --> $DIR/issue-14227.rs:4:21 | LL | static CRASH: u32 = symbol; | ^^^^^^ use of extern static diff --git a/tests/ui/statics/issue-14227.thir.stderr b/tests/ui/statics/issue-14227.thir.stderr deleted file mode 100644 index ab50b97d63f4f..0000000000000 --- 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.rs b/tests/ui/thread-local/thread-local-static.rs index afaffbb7e9bbf..e6cd4839dda7e 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.mir.stderr b/tests/ui/thread-local/thread-local-static.stderr similarity index 88% rename from tests/ui/thread-local/thread-local-static.mir.stderr rename to tests/ui/thread-local/thread-local-static.stderr index 607d7ee902cb6..f37fd9db36d6e 100644 --- a/tests/ui/thread-local/thread-local-static.mir.stderr +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -1,5 +1,5 @@ error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:10:12 + --> $DIR/thread-local-static.rs:8:12 | LL | const fn g(x: &mut [u32; 8]) { | ^ @@ -8,13 +8,13 @@ LL | const fn g(x: &mut [u32; 8]) { = 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 + --> $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:12:28 + --> $DIR/thread-local-static.rs:10:28 | LL | std::mem::swap(x, &mut STATIC_VAR_2) | ^^^^^^^^^^^^ @@ -22,7 +22,7 @@ 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 + --> $DIR/thread-local-static.rs:10:23 | LL | std::mem::swap(x, &mut STATIC_VAR_2) | ^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) = 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 + --> $DIR/thread-local-static.rs:10:23 | LL | std::mem::swap(x, &mut STATIC_VAR_2) | ^^^^^^^^^^^^^^^^^ use of mutable static 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 607d7ee902cb6..0000000000000 --- 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.rs b/tests/ui/threads-sendsync/issue-43733.rs index cac745f1e12f3..996abb4809a4a 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.mir.stderr b/tests/ui/threads-sendsync/issue-43733.stderr similarity index 92% rename from tests/ui/threads-sendsync/issue-43733.mir.stderr rename to tests/ui/threads-sendsync/issue-43733.stderr index ff83e16add9ef..9090fd0a4a6fd 100644 --- a/tests/ui/threads-sendsync/issue-43733.mir.stderr +++ b/tests/ui/threads-sendsync/issue-43733.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:19:5 + --> $DIR/issue-43733.rs:17:5 | LL | __KEY.get(Default::default) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function @@ -7,7 +7,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 - --> $DIR/issue-43733.rs:24:42 + --> $DIR/issue-43733.rs:21:42 | LL | static FOO: std::thread::LocalKey = std::thread::LocalKey::new(__getit); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function 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 94ec724044c7a..0000000000000 --- 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.rs b/tests/ui/traits/safety-fn-body.rs index 2cc4fe1b344a4..df5277473056b 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.mir.stderr b/tests/ui/traits/safety-fn-body.stderr similarity index 92% rename from tests/ui/traits/safety-fn-body.mir.stderr rename to tests/ui/traits/safety-fn-body.stderr index 9a04f3e7d6216..284e73f572d24 100644 --- a/tests/ui/traits/safety-fn-body.mir.stderr +++ b/tests/ui/traits/safety-fn-body.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/safety-fn-body.rs:14:9 + --> $DIR/safety-fn-body.rs:11:9 | LL | *self += 1; | ^^^^^^^^^^ dereference of raw pointer 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 5d4626c161ea9..0000000000000 --- 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 6a44f27dbb2a4..67ab10fef4bdf 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 b19eab9f52b52..21b9fc50e1d8e 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 dcc552ac75c89..1009def7d522b 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.rs b/tests/ui/union/union-borrow-move-parent-sibling.rs index 83781c5e55092..5b0b44232e411 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.mirunsafeck.stderr b/tests/ui/union/union-borrow-move-parent-sibling.stderr similarity index 89% rename from tests/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr rename to tests/ui/union/union-borrow-move-parent-sibling.stderr index 7f931b49a58f5..c9a440a66cc82 100644 --- a/tests/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr +++ b/tests/ui/union/union-borrow-move-parent-sibling.stderr @@ -1,5 +1,5 @@ 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 + --> $DIR/union-borrow-move-parent-sibling.rs:53:13 | LL | let a = &mut (*u.x).0; | --- mutable borrow occurs here (via `u.x`) @@ -11,7 +11,7 @@ LL | use_borrow(a); = 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 + --> $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 @@ -22,7 +22,7 @@ LL | let a = &u.x.0; | + error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:64:13 + --> $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 @@ -33,7 +33,7 @@ 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 + --> $DIR/union-borrow-move-parent-sibling.rs:67:13 | LL | let a = &mut ((*u.x).0).0; | --- mutable borrow occurs here (via `u.x`) @@ -45,7 +45,7 @@ LL | use_borrow(a); = 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 + --> $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 @@ -56,7 +56,7 @@ LL | let a = &(u.x.0).0; | + error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:78:13 + --> $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 @@ -67,7 +67,7 @@ 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 + --> $DIR/union-borrow-move-parent-sibling.rs:81:13 | LL | let a = &mut *u.y; | --- mutable borrow occurs here (via `u.y`) 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 7f931b49a58f5..0000000000000 --- 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 32a546cf35f2c..d5b3055959563 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 ca48785cd9f5a..15a20899a78d1 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 32ee4a739ea6c..70a97795b758c 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.rs b/tests/ui/union/union-deref.rs index 5aa28d93f96ed..02f9bf2c413f4 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.mirunsafeck.stderr b/tests/ui/union/union-deref.stderr similarity index 91% rename from tests/ui/union/union-deref.mirunsafeck.stderr rename to tests/ui/union/union-deref.stderr index be5e60ab88a59..38fce568ae78c 100644 --- a/tests/ui/union/union-deref.mirunsafeck.stderr +++ b/tests/ui/union/union-deref.stderr @@ -1,5 +1,5 @@ error: not automatically applying `DerefMut` on `ManuallyDrop` union field - --> $DIR/union-deref.rs:16:14 + --> $DIR/union-deref.rs:13:14 | LL | unsafe { u.f.0 = Vec::new() }; | ^^^ @@ -8,7 +8,7 @@ LL | unsafe { u.f.0 = Vec::new() }; = 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 + --> $DIR/union-deref.rs:15:19 | LL | unsafe { &mut u.f.0 }; | ^^^ @@ -17,7 +17,7 @@ LL | unsafe { &mut u.f.0 }; = 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 + --> $DIR/union-deref.rs:17:14 | LL | unsafe { u.f.0.push(0) }; | ^^^ @@ -26,7 +26,7 @@ LL | unsafe { u.f.0.push(0) }; = 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 + --> $DIR/union-deref.rs:21:14 | LL | unsafe { u.f.0.0 = Vec::new() }; | ^^^^^ @@ -35,7 +35,7 @@ LL | unsafe { u.f.0.0 = Vec::new() }; = 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 + --> $DIR/union-deref.rs:23:19 | LL | unsafe { &mut u.f.0.0 }; | ^^^^^ @@ -44,7 +44,7 @@ LL | unsafe { &mut u.f.0.0 }; = 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 + --> $DIR/union-deref.rs:25:14 | LL | unsafe { u.f.0.0.push(0) }; | ^^^^^ diff --git a/tests/ui/union/union-deref.thirunsafeck.stderr b/tests/ui/union/union-deref.thirunsafeck.stderr deleted file mode 100644 index be5e60ab88a59..0000000000000 --- 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.rs b/tests/ui/union/union-derive-clone.rs index 7aa62146e5490..7ab19edb47179 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.mirunsafeck.stderr b/tests/ui/union/union-derive-clone.stderr similarity index 92% rename from tests/ui/union/union-derive-clone.mirunsafeck.stderr rename to tests/ui/union/union-derive-clone.stderr index 4d23d230fa3f6..39f1e32e6eb71 100644 --- a/tests/ui/union/union-derive-clone.mirunsafeck.stderr +++ b/tests/ui/union/union-derive-clone.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U1: Copy` is not satisfied - --> $DIR/union-derive-clone.rs:6:10 + --> $DIR/union-derive-clone.rs:3:10 | LL | #[derive(Clone)] | ^^^^^ the trait `Copy` is not implemented for `U1` @@ -14,7 +14,7 @@ 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 + --> $DIR/union-derive-clone.rs:35:15 | LL | union U5 { | ----------- @@ -29,7 +29,7 @@ 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 + --> $DIR/union-derive-clone.rs:25:10 | LL | #[derive(Clone, Copy)] | ^^^^^ unsatisfied trait bound introduced in this `derive` macro 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 4d23d230fa3f6..0000000000000 --- 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.rs b/tests/ui/union/union-derive-eq.rs index b7e7f343f8a28..e689f8c27d772 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.mirunsafeck.stderr b/tests/ui/union/union-derive-eq.stderr similarity index 95% rename from tests/ui/union/union-derive-eq.mirunsafeck.stderr rename to tests/ui/union/union-derive-eq.stderr index 86e7c955d2eea..b068edd6d69cc 100644 --- a/tests/ui/union/union-derive-eq.mirunsafeck.stderr +++ b/tests/ui/union/union-derive-eq.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `PartialEqNotEq: Eq` is not satisfied - --> $DIR/union-derive-eq.rs:16:5 + --> $DIR/union-derive-eq.rs:13:5 | LL | #[derive(Eq)] | -- in this derive macro expansion 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 86e7c955d2eea..0000000000000 --- 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 8276bc635fc74..826b9e5a7c6e1 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 c3d7d41ca35fb..41c1e9243f7f8 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 0c9981c69fcba..0000000000000 --- 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 cf2ef4c03d689..8ab34b55da21c 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.thirunsafeck.stderr b/tests/ui/union/union-fields-1.stderr similarity index 82% rename from tests/ui/union/union-fields-1.thirunsafeck.stderr rename to tests/ui/union/union-fields-1.stderr index 0c9981c69fcba..bba8aae6024e9 100644 --- a/tests/ui/union/union-fields-1.thirunsafeck.stderr +++ b/tests/ui/union/union-fields-1.stderr @@ -1,5 +1,5 @@ error: field `c` is never read - --> $DIR/union-fields-1.rs:9:5 + --> $DIR/union-fields-1.rs:6:5 | LL | union U1 { | -- field in this union @@ -8,13 +8,13 @@ LL | c: u8, | ^ | note: the lint level is defined here - --> $DIR/union-fields-1.rs:4:9 + --> $DIR/union-fields-1.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: field `a` is never read - --> $DIR/union-fields-1.rs:12:5 + --> $DIR/union-fields-1.rs:9:5 | LL | union U2 { | -- field in this union @@ -22,7 +22,7 @@ LL | a: u8, | ^ error: field `a` is never read - --> $DIR/union-fields-1.rs:16:20 + --> $DIR/union-fields-1.rs:13:20 | LL | union NoDropLike { a: u8 } | ---------- ^ @@ -30,7 +30,7 @@ LL | union NoDropLike { a: u8 } | field in this union error: field `c` is never read - --> $DIR/union-fields-1.rs:21:5 + --> $DIR/union-fields-1.rs:18:5 | LL | union U { | - field in this union diff --git a/tests/ui/union/union-fields-2.rs b/tests/ui/union/union-fields-2.rs index e738b18470337..71b204fcdc5b8 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.mirunsafeck.stderr b/tests/ui/union/union-fields-2.stderr similarity index 86% rename from tests/ui/union/union-fields-2.mirunsafeck.stderr rename to tests/ui/union/union-fields-2.stderr index 1157f0c2ae770..142186885caa8 100644 --- a/tests/ui/union/union-fields-2.mirunsafeck.stderr +++ b/tests/ui/union/union-fields-2.stderr @@ -1,17 +1,17 @@ error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:10:13 + --> $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:12:13 + --> $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:13:29 + --> $DIR/union-fields-2.rs:10:29 | LL | let u = U { a: 0, b: 1, c: 2 }; | ^ `U` does not have this field @@ -19,61 +19,61 @@ LL | let u = U { a: 0, b: 1, c: 2 }; = note: all struct fields are already assigned error[E0784]: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:13:13 + --> $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:15:13 + --> $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:15:19 + --> $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:18:9 + --> $DIR/union-fields-2.rs:15:9 | LL | let U {} = u; | ^^^^ error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:20:9 + --> $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:21:9 + --> $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:21:19 + --> $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:23:9 + --> $DIR/union-fields-2.rs:20:9 | LL | let U { .. } = u; | ^^^^^^^^ error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:23:9 + --> $DIR/union-fields-2.rs:20:9 | LL | let U { .. } = u; | ^^^^^^^^ error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:25:9 + --> $DIR/union-fields-2.rs:22:9 | LL | let U { a, .. } = u; | ^^^^^^^^^^^ 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 1157f0c2ae770..0000000000000 --- 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 25f1f5050f99b..69837f31cab27 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.rs b/tests/ui/union/union-generic.rs index 3d68ecb87d8d6..ff877892579b9 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.mirunsafeck.stderr b/tests/ui/union/union-generic.stderr similarity index 84% rename from tests/ui/union/union-generic.mirunsafeck.stderr rename to tests/ui/union/union-generic.stderr index 037022a91fcd0..b9d4aee787e93 100644 --- a/tests/ui/union/union-generic.mirunsafeck.stderr +++ b/tests/ui/union/union-generic.stderr @@ -1,23 +1,23 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:11:13 + --> $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:6:12 + --> $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:13:17 + --> $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:6:12 + --> $DIR/union-generic.rs:3:12 | LL | union U { | ^^^^ required by this bound in `U` diff --git a/tests/ui/union/union-generic.thirunsafeck.stderr b/tests/ui/union/union-generic.thirunsafeck.stderr deleted file mode 100644 index 037022a91fcd0..0000000000000 --- 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 b0fd22da73adc..2e75cce7b108b 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.rs b/tests/ui/union/union-lint-dead-code.rs index 65aaf0a1d35da..cb2cdd4dba008 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.mirunsafeck.stderr b/tests/ui/union/union-lint-dead-code.stderr similarity index 77% rename from tests/ui/union/union-lint-dead-code.mirunsafeck.stderr rename to tests/ui/union/union-lint-dead-code.stderr index 8a3677d525d66..691a5e19ae6b9 100644 --- a/tests/ui/union/union-lint-dead-code.mirunsafeck.stderr +++ b/tests/ui/union/union-lint-dead-code.stderr @@ -1,5 +1,5 @@ error: field `b` is never read - --> $DIR/union-lint-dead-code.rs:8:5 + --> $DIR/union-lint-dead-code.rs:5:5 | LL | union Foo { | --- field in this union @@ -8,7 +8,7 @@ LL | b: bool, | ^ | note: the lint level is defined here - --> $DIR/union-lint-dead-code.rs:4:9 + --> $DIR/union-lint-dead-code.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ 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 8a3677d525d66..0000000000000 --- 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 7fd9d8221c612..5ca013a44cd85 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 826bdf07cef5e..ba99e7441e6cb 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.rs b/tests/ui/union/union-move.rs index b8b1ac8046a03..76220a7d40a65 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.mirunsafeck.stderr b/tests/ui/union/union-move.stderr similarity index 91% rename from tests/ui/union/union-move.mirunsafeck.stderr rename to tests/ui/union/union-move.stderr index 6381ae874ba81..47fb801a50ecd 100644 --- a/tests/ui/union/union-move.mirunsafeck.stderr +++ b/tests/ui/union/union-move.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/union-move.rs:29:18 + --> $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 @@ -10,7 +10,7 @@ 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 + --> $DIR/union-move.rs:7:19 | LL | fn move_out(x: T) {} | -------- ^ this parameter takes ownership of the value @@ -18,7 +18,7 @@ LL | fn move_out(x: T) {} | in this function error[E0382]: use of moved value: `x` - --> $DIR/union-move.rs:45:18 + --> $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 @@ -29,7 +29,7 @@ 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 + --> $DIR/union-move.rs:7:19 | LL | fn move_out(x: T) {} | -------- ^ this parameter takes ownership of the value @@ -37,7 +37,7 @@ LL | fn move_out(x: T) {} | in this function error[E0509]: cannot move out of type `U2`, which implements the `Drop` trait - --> $DIR/union-move.rs:52:18 + --> $DIR/union-move.rs:49:18 | LL | move_out(x.f1_nocopy); | ^^^^^^^^^^^ diff --git a/tests/ui/union/union-move.thirunsafeck.stderr b/tests/ui/union/union-move.thirunsafeck.stderr deleted file mode 100644 index 6381ae874ba81..0000000000000 --- 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 6e6b105a73e9f..7ce17a7c825ff 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 3f4f7ea1c10c3..e7ab4ebe32385 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 0eea14d9de0fc..399ed9ae458b8 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 9c6398bf5aa63..538c337a773c8 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 d628a200a076e..17ac6c6dfa9bf 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.rs b/tests/ui/union/union-suggest-field.rs index 601a22a060048..71b93e873c220 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.mirunsafeck.stderr b/tests/ui/union/union-suggest-field.stderr similarity index 88% rename from tests/ui/union/union-suggest-field.mirunsafeck.stderr rename to tests/ui/union/union-suggest-field.stderr index efe4987bd0252..5c428cf6c8993 100644 --- a/tests/ui/union/union-suggest-field.mirunsafeck.stderr +++ b/tests/ui/union/union-suggest-field.stderr @@ -1,5 +1,5 @@ error[E0560]: union `U` has no field named `principle` - --> $DIR/union-suggest-field.rs:13:17 + --> $DIR/union-suggest-field.rs:10:17 | LL | let u = U { principle: 0 }; | ^^^^^^^^^ unknown field @@ -10,7 +10,7 @@ LL | let u = U { principal: 0 }; | ~~~~~~~~~ error[E0609]: no field `principial` on type `U` - --> $DIR/union-suggest-field.rs:17:15 + --> $DIR/union-suggest-field.rs:14:15 | LL | let w = u.principial; | ^^^^^^^^^^ unknown field @@ -21,7 +21,7 @@ LL | let w = u.principal; | ~~~~~~~~~ error[E0615]: attempted to take value of method `calculate` on type `U` - --> $DIR/union-suggest-field.rs:21:15 + --> $DIR/union-suggest-field.rs:18:15 | LL | let y = u.calculate; | ^^^^^^^^^ method, not a field 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 efe4987bd0252..0000000000000 --- 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 6134e91f31e49..8a7ac81724040 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 1a3b32d55f321..be8062f6276fd 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.rs b/tests/ui/union/union-unsafe.rs index d1465486f7784..bd3946686be36 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.mir.stderr b/tests/ui/union/union-unsafe.stderr similarity index 91% rename from tests/ui/union/union-unsafe.mir.stderr rename to tests/ui/union/union-unsafe.stderr index 15f059ffa4875..4d3408a89af29 100644 --- a/tests/ui/union/union-unsafe.mir.stderr +++ b/tests/ui/union/union-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:34:5 + --> $DIR/union-unsafe.rs:31:5 | LL | *(u.p) = 13; | ^^^^^^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | *(u.p) = 13; = 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 + --> $DIR/union-unsafe.rs:43:6 | LL | *u3.a = T::default(); | ^^^^ access to union field @@ -15,7 +15,7 @@ LL | *u3.a = T::default(); = 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 + --> $DIR/union-unsafe.rs:49:6 | LL | *u3.a = T::default(); | ^^^^ access to union field @@ -23,7 +23,7 @@ LL | *u3.a = T::default(); = 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 + --> $DIR/union-unsafe.rs:57:13 | LL | let a = u1.a; | ^^^^ access to union field @@ -31,7 +31,7 @@ LL | let a = 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/union-unsafe.rs:64:14 + --> $DIR/union-unsafe.rs:60:14 | LL | let U1 { a } = u1; | ^ access to union field @@ -39,7 +39,7 @@ 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:65:12 + --> $DIR/union-unsafe.rs:61:12 | LL | if let U1 { a: 12 } = u1 {} | ^^^^^^^^^^^^ access to union field @@ -47,7 +47,7 @@ LL | if let U1 { a: 12 } = 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:66:12 + --> $DIR/union-unsafe.rs:62:12 | LL | if let Some(U1 { a: 13 }) = Some(u1) {} | ^^^^^^^^^^^^^^^^^^ access to union field @@ -55,7 +55,7 @@ LL | if let Some(U1 { a: 13 }) = Some(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:71:6 + --> $DIR/union-unsafe.rs:67:6 | LL | *u2.a = String::from("new"); | ^^^^ access to union field @@ -63,7 +63,7 @@ LL | *u2.a = String::from("new"); = 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 + --> $DIR/union-unsafe.rs:71:6 | LL | *u3.a = 1; | ^^^^ access to union field @@ -71,7 +71,7 @@ LL | *u3.a = 1; = 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 + --> $DIR/union-unsafe.rs:75:6 | LL | *u3.a = String::from("new"); | ^^^^ access to union field diff --git a/tests/ui/union/union-unsafe.thir.stderr b/tests/ui/union/union-unsafe.thir.stderr deleted file mode 100644 index 9ce835497c519..0000000000000 --- 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.rs b/tests/ui/union/union-unsized.rs index b95b2e414f39a..5dd32192ab9e5 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.mirunsafeck.stderr b/tests/ui/union/union-unsized.stderr similarity index 80% rename from tests/ui/union/union-unsized.mirunsafeck.stderr rename to tests/ui/union/union-unsized.stderr index de7e690d80fc9..3d2e699f630b4 100644 --- a/tests/ui/union/union-unsized.mirunsafeck.stderr +++ b/tests/ui/union/union-unsized.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:5:8 + --> $DIR/union-unsized.rs:2:8 | LL | a: str, | ^^^ doesn't have a size known at compile-time @@ -29,7 +29,7 @@ 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 + --> $DIR/union-unsized.rs:11:8 | LL | b: str, | ^^^ doesn't have a size known at compile-time @@ -47,7 +47,19 @@ 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 + --> $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, | ^^^^^^ diff --git a/tests/ui/union/union-unsized.thirunsafeck.stderr b/tests/ui/union/union-unsized.thirunsafeck.stderr deleted file mode 100644 index de7e690d80fc9..0000000000000 --- 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.rs b/tests/ui/union/union-with-drop-fields.rs index 9720830fb1ff2..ae147e9bd2b5d 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.mirunsafeck.stderr b/tests/ui/union/union-with-drop-fields.stderr similarity index 91% rename from tests/ui/union/union-with-drop-fields.mirunsafeck.stderr rename to tests/ui/union/union-with-drop-fields.stderr index 9861a21cb3d8f..6328be565408e 100644 --- a/tests/ui/union/union-with-drop-fields.mirunsafeck.stderr +++ b/tests/ui/union/union-with-drop-fields.stderr @@ -1,5 +1,5 @@ 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 + --> $DIR/union-with-drop-fields.rs:8:5 | LL | a: String, | ^^^^^^^^^ @@ -11,7 +11,7 @@ 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 + --> $DIR/union-with-drop-fields.rs:16:5 | LL | a: S, | ^^^^ @@ -23,7 +23,7 @@ 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 + --> $DIR/union-with-drop-fields.rs:21:5 | LL | a: T, | ^^^^ 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 9861a21cb3d8f..0000000000000 --- 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.rs b/tests/ui/unsafe/access_union_field.rs index 5c4e695df58f2..4183119725eca 100644 --- a/tests/ui/unsafe/access_union_field.rs +++ b/tests/ui/unsafe/access_union_field.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![allow(unused_variables)] union Foo { diff --git a/tests/ui/unsafe/access_union_field.mir.stderr b/tests/ui/unsafe/access_union_field.stderr similarity index 89% rename from tests/ui/unsafe/access_union_field.mir.stderr rename to tests/ui/unsafe/access_union_field.stderr index 98bc4077793e3..4c46bb44a1d33 100644 --- a/tests/ui/unsafe/access_union_field.mir.stderr +++ b/tests/ui/unsafe/access_union_field.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:13:13 + --> $DIR/access_union_field.rs:10:13 | LL | let a = foo.bar; | ^^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | let a = foo.bar; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:14:13 + --> $DIR/access_union_field.rs:11:13 | LL | let b = foo.baz; | ^^^^^^^ access to union field diff --git a/tests/ui/unsafe/access_union_field.thir.stderr b/tests/ui/unsafe/access_union_field.thir.stderr deleted file mode 100644 index 98bc4077793e3..0000000000000 --- a/tests/ui/unsafe/access_union_field.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:13:13 - | -LL | let a = foo.bar; - | ^^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/access_union_field.rs:14:13 - | -LL | let b = foo.baz; - | ^^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs index 1b429955cb035..9e150326f0bb3 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs @@ -1,9 +1,6 @@ // edition: 2024 // compile-flags: -Zunstable-options // check-pass -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - #![crate_type = "lib"] #![deny(unused_unsafe)] @@ -11,8 +8,7 @@ unsafe fn unsf() {} unsafe fn foo() { unsf(); - //[mir]~^ WARN call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ WARN call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ WARN call to unsafe function is unsafe and requires unsafe block // no unused_unsafe unsafe { diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr similarity index 80% rename from tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr rename to tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr index ea53bf59d3101..9ca10b0509032 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr @@ -1,12 +1,12 @@ warning: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13:5 + --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:10:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1 + --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:9:1 | LL | unsafe fn foo() { | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr deleted file mode 100644 index d63843ed2b361..0000000000000 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1 - | -LL | unsafe fn foo() { - | ^^^^^^^^^^^^^^^ - = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.rs b/tests/ui/unsafe/foreign-unsafe-fn-called.rs index 67302ea1bcddb..abbe462021ed7 100644 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.rs +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - mod test { extern "C" { pub fn free(); @@ -9,6 +6,5 @@ mod test { fn main() { test::free(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `test::free` is unsafe + //~^ ERROR call to unsafe function is unsafe } diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr similarity index 89% rename from tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr rename to tests/ui/unsafe/foreign-unsafe-fn-called.stderr index 5157dbb514bad..b55e6130230d2 100644 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.mir.stderr +++ b/tests/ui/unsafe/foreign-unsafe-fn-called.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 + --> $DIR/foreign-unsafe-fn-called.rs:8:5 | LL | test::free(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr b/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr deleted file mode 100644 index 8c221314cd7cf..0000000000000 --- a/tests/ui/unsafe/foreign-unsafe-fn-called.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:11:5 - | -LL | test::free(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/inline_asm.rs b/tests/ui/unsafe/inline_asm.rs index 12c7efe4f50b6..df45b8640c1a4 100644 --- a/tests/ui/unsafe/inline_asm.rs +++ b/tests/ui/unsafe/inline_asm.rs @@ -1,5 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck // needs-asm-support use std::arch::asm; diff --git a/tests/ui/unsafe/inline_asm.mir.stderr b/tests/ui/unsafe/inline_asm.stderr similarity index 92% rename from tests/ui/unsafe/inline_asm.mir.stderr rename to tests/ui/unsafe/inline_asm.stderr index e38a9388a786e..1e829152a72dc 100644 --- a/tests/ui/unsafe/inline_asm.mir.stderr +++ b/tests/ui/unsafe/inline_asm.stderr @@ -1,5 +1,5 @@ error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:8:5 + --> $DIR/inline_asm.rs:6:5 | LL | asm!("nop"); | ^^^^^^^^^^^ use of inline assembly diff --git a/tests/ui/unsafe/inline_asm.thir.stderr b/tests/ui/unsafe/inline_asm.thir.stderr deleted file mode 100644 index e38a9388a786e..0000000000000 --- a/tests/ui/unsafe/inline_asm.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:8:5 - | -LL | asm!("nop"); - | ^^^^^^^^^^^ use of inline assembly - | - = note: inline assembly is entirely unchecked and can cause undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-3080.rs b/tests/ui/unsafe/issue-3080.rs index 2b5269dda8fa6..883f3bfd24e83 100644 --- a/tests/ui/unsafe/issue-3080.rs +++ b/tests/ui/unsafe/issue-3080.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - struct X(()); impl X { pub unsafe fn with(&self) { } diff --git a/tests/ui/unsafe/issue-3080.mir.stderr b/tests/ui/unsafe/issue-3080.stderr similarity index 92% rename from tests/ui/unsafe/issue-3080.mir.stderr rename to tests/ui/unsafe/issue-3080.stderr index a1ad98d205eb0..f84ba20463918 100644 --- a/tests/ui/unsafe/issue-3080.mir.stderr +++ b/tests/ui/unsafe/issue-3080.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-3080.rs:10:5 + --> $DIR/issue-3080.rs:7:5 | LL | X(()).with(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/issue-3080.thir.stderr b/tests/ui/unsafe/issue-3080.thir.stderr deleted file mode 100644 index 1018218b1b061..0000000000000 --- a/tests/ui/unsafe/issue-3080.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `X::with` is unsafe and requires unsafe function or block - --> $DIR/issue-3080.rs:10:5 - | -LL | X(()).with(); - | ^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs b/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs index 3e3da667c0b08..7c4bde185fb8e 100644 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs +++ b/tests/ui/unsafe/issue-45087-unreachable-unsafe.rs @@ -1,6 +1,4 @@ // Verify that unreachable code undergoes unsafety checks. -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck fn main() { return; diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr similarity index 87% rename from tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr rename to tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr index e7960960774fc..cc1e73bb93288 100644 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.mir.stderr +++ b/tests/ui/unsafe/issue-45087-unreachable-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:7:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:5:5 | LL | *(1 as *mut u32) = 42; | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer @@ -7,7 +7,7 @@ LL | *(1 as *mut u32) = 42; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:17:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:15:5 | LL | *a = 1; | ^^^^^^ dereference of raw pointer @@ -15,7 +15,7 @@ LL | *a = 1; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:29:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:27:5 | LL | *b = 1; | ^^^^^^ dereference of raw pointer diff --git a/tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr b/tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr deleted file mode 100644 index e81adad450750..0000000000000 --- a/tests/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:7:5 - | -LL | *(1 as *mut u32) = 42; - | ^^^^^^^^^^^^^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:17:5 - | -LL | *a = 1; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:29:5 - | -LL | *b = 1; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs index ac1cfd62a0568..de275ff701a61 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.mir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr similarity index 78% rename from tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.stderr rename to tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr index 9e9cbcf33ae17..321698e763696 100644 --- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.mir.stderr +++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -1,5 +1,5 @@ error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:10:13 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:7:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -8,13 +8,13 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:4:8 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:1:8 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:12:38 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:9:38 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -23,7 +23,7 @@ LL | |w: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:16:34 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:13:34 | LL | unsafe { | ------ because it's nested under this `unsafe` block diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr deleted file mode 100644 index 2267da31512f0..0000000000000 --- 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.rs b/tests/ui/unsafe/issue-47412.rs index df6d6e4222e82..2d1ea72280b2d 100644 --- a/tests/ui/unsafe/issue-47412.rs +++ b/tests/ui/unsafe/issue-47412.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #[derive(Copy, Clone)] enum Void {} diff --git a/tests/ui/unsafe/issue-47412.mir.stderr b/tests/ui/unsafe/issue-47412.stderr similarity index 91% rename from tests/ui/unsafe/issue-47412.mir.stderr rename to tests/ui/unsafe/issue-47412.stderr index 305f482e8c21d..aebcbf0746305 100644 --- a/tests/ui/unsafe/issue-47412.mir.stderr +++ b/tests/ui/unsafe/issue-47412.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:14:11 + --> $DIR/issue-47412.rs:11:11 | LL | match u.void {} | ^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | match u.void {} = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:20:11 + --> $DIR/issue-47412.rs:17:11 | LL | match *ptr {} | ^^^^ dereference of raw pointer diff --git a/tests/ui/unsafe/issue-47412.thir.stderr b/tests/ui/unsafe/issue-47412.thir.stderr deleted file mode 100644 index 305f482e8c21d..0000000000000 --- 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 72f7b67477712..b0d738855d731 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 99e40ba4b4c04..a004d73942224 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.rs b/tests/ui/unsafe/ranged_ints.rs index 05efe87ba6e03..0fa2da917e9f8 100644 --- a/tests/ui/unsafe/ranged_ints.rs +++ b/tests/ui/unsafe/ranged_ints.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints.mir.stderr b/tests/ui/unsafe/ranged_ints.stderr similarity index 93% rename from tests/ui/unsafe/ranged_ints.mir.stderr rename to tests/ui/unsafe/ranged_ints.stderr index ef00edae05d9f..b6875e1581514 100644 --- a/tests/ui/unsafe/ranged_ints.mir.stderr +++ b/tests/ui/unsafe/ranged_ints.stderr @@ -1,5 +1,5 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints.rs:10:14 + --> $DIR/ranged_ints.rs:7:14 | LL | let _x = NonZero(0); | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr diff --git a/tests/ui/unsafe/ranged_ints.thir.stderr b/tests/ui/unsafe/ranged_ints.thir.stderr deleted file mode 100644 index ef00edae05d9f..0000000000000 --- a/tests/ui/unsafe/ranged_ints.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints.rs:10:14 - | -LL | let _x = NonZero(0); - | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr - | - = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints2.rs b/tests/ui/unsafe/ranged_ints2.rs index ad9d598aba2a4..a3d9f54efe20c 100644 --- a/tests/ui/unsafe/ranged_ints2.rs +++ b/tests/ui/unsafe/ranged_ints2.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.stderr similarity index 91% rename from tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints2.stderr index dc6bd72f56c57..1885e77af7e0b 100644 --- a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints2.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:11:13 + --> $DIR/ranged_ints2.rs:8:13 | LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field @@ -7,7 +7,7 @@ LL | let y = &mut x.0; = note: mutating layout constrained fields cannot statically be checked for valid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:12:25 + --> $DIR/ranged_ints2.rs:9:25 | LL | if let Some(NonZero(ref mut y)) = Some(x) {} | ^^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr deleted file mode 100644 index dc6bd72f56c57..0000000000000 --- a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:11:13 - | -LL | let y = &mut x.0; - | ^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2.rs:12:25 - | -LL | if let Some(NonZero(ref mut y)) = Some(x) {} - | ^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints2_const.rs b/tests/ui/unsafe/ranged_ints2_const.rs index 56f5407bb6ebe..b7178c2b52bfb 100644 --- a/tests/ui/unsafe/ranged_ints2_const.rs +++ b/tests/ui/unsafe/ranged_ints2_const.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2_const.stderr similarity index 90% rename from tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints2_const.stderr index c16550a58005f..a0dc950e76dd1 100644 --- a/tests/ui/unsafe/ranged_ints2_const.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints2_const.stderr @@ -1,5 +1,5 @@ error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:14:13 + --> $DIR/ranged_ints2_const.rs:11:13 | LL | let y = &mut x.0; | ^^^^^^^^ @@ -8,7 +8,7 @@ LL | let y = &mut x.0; = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:21:22 + --> $DIR/ranged_ints2_const.rs:18:22 | LL | let y = unsafe { &mut x.0 }; | ^^^^^^^^ @@ -17,7 +17,7 @@ LL | let y = unsafe { &mut x.0 }; = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:27:22 + --> $DIR/ranged_ints2_const.rs:24:22 | LL | unsafe { let y = &mut x.0; } | ^^^^^^^^ @@ -26,7 +26,7 @@ LL | unsafe { let y = &mut x.0; } = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints2_const.rs:14:13 + --> $DIR/ranged_ints2_const.rs:11:13 | LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2_const.thirunsafeck.stderr deleted file mode 100644 index b3f139f7213ff..0000000000000 --- 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.rs b/tests/ui/unsafe/ranged_ints3.rs index 76d4bfe95307d..47d67fac6785c 100644 --- a/tests/ui/unsafe/ranged_ints3.rs +++ b/tests/ui/unsafe/ranged_ints3.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] use std::cell::Cell; diff --git a/tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3.stderr similarity index 93% rename from tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints3.stderr index 72bce5de0aed9..8dcb99fc16dbf 100644 --- a/tests/ui/unsafe/ranged_ints3.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints3.stderr @@ -1,5 +1,5 @@ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3.rs:13:13 + --> $DIR/ranged_ints3.rs:10:13 | LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability diff --git a/tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr deleted file mode 100644 index 72bce5de0aed9..0000000000000 --- a/tests/ui/unsafe/ranged_ints3.thirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3.rs:13:13 - | -LL | let y = &x.0; - | ^^^^ borrow of layout constrained field with interior mutability - | - = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints3_const.rs b/tests/ui/unsafe/ranged_ints3_const.rs index 637198d360422..c069ae7da0212 100644 --- a/tests/ui/unsafe/ranged_ints3_const.rs +++ b/tests/ui/unsafe/ranged_ints3_const.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] use std::cell::Cell; diff --git a/tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_const.stderr similarity index 91% rename from tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints3_const.stderr index 62df933306962..215005571f6d7 100644 --- a/tests/ui/unsafe/ranged_ints3_const.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints3_const.stderr @@ -1,5 +1,5 @@ error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/ranged_ints3_const.rs:15:13 + --> $DIR/ranged_ints3_const.rs:12:13 | LL | let y = &x.0; | ^^^^ @@ -8,7 +8,7 @@ LL | let y = &x.0; = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/ranged_ints3_const.rs:22:22 + --> $DIR/ranged_ints3_const.rs:19:22 | LL | let y = unsafe { &x.0 }; | ^^^^ @@ -17,7 +17,7 @@ LL | let y = unsafe { &x.0 }; = help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_const.rs:15:13 + --> $DIR/ranged_ints3_const.rs:12:13 | LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability diff --git a/tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_const.thirunsafeck.stderr deleted file mode 100644 index 5dbc563aad261..0000000000000 --- 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.rs b/tests/ui/unsafe/ranged_ints3_match.rs index d9fcf0bd665c2..de6be506d5611 100644 --- a/tests/ui/unsafe/ranged_ints3_match.rs +++ b/tests/ui/unsafe/ranged_ints3_match.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] use std::cell::Cell; diff --git a/tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_match.stderr similarity index 91% rename from tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints3_match.stderr index 27c06640928fa..1bdc29d077c0f 100644 --- a/tests/ui/unsafe/ranged_ints3_match.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints3_match.stderr @@ -1,5 +1,5 @@ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_match.rs:14:17 + --> $DIR/ranged_ints3_match.rs:11:17 | LL | NonZero(ref x) => { x } | ^^^^^ borrow of layout constrained field with interior mutability @@ -7,7 +7,7 @@ LL | NonZero(ref x) => { x } = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints3_match.rs:20:23 + --> $DIR/ranged_ints3_match.rs:17:23 | LL | match y { NonZero(ref mut y) => { y } }; | ^^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints3_match.thirunsafeck.stderr deleted file mode 100644 index 27c06640928fa..0000000000000 --- 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 4f2f1e42e7653..0000000000000 --- 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 fe80af454cb8d..d8632c48434f2 100644 --- a/tests/ui/unsafe/ranged_ints4.rs +++ b/tests/ui/unsafe/ranged_ints4.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4.stderr similarity index 92% rename from tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints4.stderr index 4f2f1e42e7653..4a703696b8847 100644 --- a/tests/ui/unsafe/ranged_ints4.thirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints4.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4.rs:11:5 + --> $DIR/ranged_ints4.rs:8:5 | LL | x.0 = 0; | ^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints4_const.rs b/tests/ui/unsafe/ranged_ints4_const.rs index a43c8be71c4fd..f09168c3d3f9c 100644 --- a/tests/ui/unsafe/ranged_ints4_const.rs +++ b/tests/ui/unsafe/ranged_ints4_const.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4_const.stderr similarity index 90% rename from tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr rename to tests/ui/unsafe/ranged_ints4_const.stderr index a2a3ae668a2c4..604ec1167e49f 100644 --- a/tests/ui/unsafe/ranged_ints4_const.mirunsafeck.stderr +++ b/tests/ui/unsafe/ranged_ints4_const.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4_const.rs:13:5 + --> $DIR/ranged_ints4_const.rs:10:5 | LL | x.0 = 0; | ^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr deleted file mode 100644 index a2a3ae668a2c4..0000000000000 --- a/tests/ui/unsafe/ranged_ints4_const.thirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/ranged_ints4_const.rs:13:5 - | -LL | x.0 = 0; - | ^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/ranged_ints_const.rs b/tests/ui/unsafe/ranged_ints_const.rs index 472b096815075..8477772867e91 100644 --- a/tests/ui/unsafe/ranged_ints_const.rs +++ b/tests/ui/unsafe/ranged_ints_const.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #[rustc_layout_scalar_valid_range_start(1)] diff --git a/tests/ui/unsafe/ranged_ints_const.mir.stderr b/tests/ui/unsafe/ranged_ints_const.stderr similarity index 93% rename from tests/ui/unsafe/ranged_ints_const.mir.stderr rename to tests/ui/unsafe/ranged_ints_const.stderr index 563b9be267210..2b8be290d3adb 100644 --- a/tests/ui/unsafe/ranged_ints_const.mir.stderr +++ b/tests/ui/unsafe/ranged_ints_const.stderr @@ -1,5 +1,5 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block - --> $DIR/ranged_ints_const.rs:11:34 + --> $DIR/ranged_ints_const.rs:8:34 | LL | const fn foo() -> NonZero { NonZero(0) } | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr diff --git a/tests/ui/unsafe/ranged_ints_const.thir.stderr b/tests/ui/unsafe/ranged_ints_const.thir.stderr deleted file mode 100644 index 563b9be267210..0000000000000 --- 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 8293d029951fa..0acc3e0f6b1a8 100644 --- a/tests/ui/unsafe/ranged_ints_macro.rs +++ b/tests/ui/unsafe/ranged_ints_macro.rs @@ -1,6 +1,4 @@ // build-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #![feature(rustc_attrs)] diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs index db1e916a36c1f..eceac115eddd2 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck - #![deny(unsafe_op_in_unsafe_fn)] #![deny(unused_unsafe)] @@ -10,8 +7,7 @@ static mut VOID: () = (); unsafe fn deny_level() { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ ERROR call to unsafe function is unsafe and requires unsafe block *PTR; //~^ ERROR dereference of raw pointer is unsafe and requires unsafe block VOID = (); @@ -26,8 +22,7 @@ unsafe fn deny_level() { #[deny(warnings)] unsafe fn warning_level() { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ ERROR call to unsafe function is unsafe and requires unsafe block *PTR; //~^ ERROR dereference of raw pointer is unsafe and requires unsafe block VOID = (); @@ -74,12 +69,10 @@ unsafe fn nested_allow_level() { fn main() { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe block + //~^ ERROR call to unsafe function is unsafe and requires unsafe block #[allow(unsafe_op_in_unsafe_fn)] { unsf(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block - //[thir]~^^ ERROR call to unsafe function `unsf` is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block } } diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr similarity index 81% rename from tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr rename to tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr index 0c0826c1cfb39..d61d87cd00146 100644 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr +++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.stderr @@ -1,23 +1,23 @@ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:12:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:9:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:1 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:8:1 | LL | unsafe fn deny_level() { | ^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:1:9 | LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:15:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:5 | LL | *PTR; | ^^^^ dereference of raw pointer @@ -25,7 +25,7 @@ LL | *PTR; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:17:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:13:5 | LL | VOID = (); | ^^^^^^^^^ use of mutable static @@ -33,38 +33,38 @@ LL | VOID = (); = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:20:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:16:5 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:5:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:2:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:24:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:1 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:23:1 | LL | unsafe fn warning_level() { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:8 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:22:8 | LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]` error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:5 | LL | *PTR; | ^^^^ dereference of raw pointer @@ -72,7 +72,7 @@ LL | *PTR; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 | LL | VOID = (); | ^^^^^^^^^ use of mutable static @@ -80,19 +80,19 @@ LL | VOID = (); = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:35:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:30:5 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:44:5 | LL | unsafe { unsafe { unsf() } } | ^^^^^^ unnecessary `unsafe` block error[E0133]: call to unsafe function is unsafe and requires unsafe block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:71:5 | LL | unsf(); | ^^^^^^ call to unsafe function @@ -100,7 +100,7 @@ LL | unsf(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:75:9 | LL | unsf(); | ^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr deleted file mode 100644 index ad0621a1d0435..0000000000000 --- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr +++ /dev/null @@ -1,112 +0,0 @@ -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:12:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:1 - | -LL | unsafe fn deny_level() { - | ^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9 - | -LL | #![deny(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:15:5 - | -LL | *PTR; - | ^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:17:5 - | -LL | VOID = (); - | ^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:20:5 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:5:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:1 - | -LL | unsafe fn warning_level() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:8 - | -LL | #[deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]` - -error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:31:5 - | -LL | *PTR; - | ^^^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:33:5 - | -LL | VOID = (); - | ^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:35:5 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5 - | -LL | unsafe { unsafe { unsf() } } - | ^^^^^^ unnecessary `unsafe` block - -error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe function or block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9 - | -LL | unsf(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 11 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/union-assignop.rs b/tests/ui/unsafe/union-assignop.rs index 5e667cd10d59f..6122aef0565e0 100644 --- a/tests/ui/unsafe/union-assignop.rs +++ b/tests/ui/unsafe/union-assignop.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - use std::ops::AddAssign; use std::mem::ManuallyDrop; diff --git a/tests/ui/unsafe/union-assignop.mirunsafeck.stderr b/tests/ui/unsafe/union-assignop.stderr similarity index 89% rename from tests/ui/unsafe/union-assignop.mirunsafeck.stderr rename to tests/ui/unsafe/union-assignop.stderr index 0ecd5203dd9d9..e3a673ee1ff8e 100644 --- a/tests/ui/unsafe/union-assignop.mirunsafeck.stderr +++ b/tests/ui/unsafe/union-assignop.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:19:5 + --> $DIR/union-assignop.rs:16:5 | LL | foo.a += 5; | ^^^^^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | foo.a += 5; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:20:6 + --> $DIR/union-assignop.rs:17:6 | LL | *foo.b += NonCopy; | ^^^^^ access to union field @@ -15,7 +15,7 @@ LL | *foo.b += NonCopy; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:21:6 + --> $DIR/union-assignop.rs:18:6 | LL | *foo.b = NonCopy; | ^^^^^ access to union field @@ -23,7 +23,7 @@ LL | *foo.b = NonCopy; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:23:5 + --> $DIR/union-assignop.rs:20:5 | LL | foo.a; | ^^^^^ access to union field @@ -31,7 +31,7 @@ LL | foo.a; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:25:5 + --> $DIR/union-assignop.rs:22:5 | LL | foo.b; | ^^^^^ access to union field @@ -39,7 +39,7 @@ LL | foo.b; = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-assignop.rs:27:13 + --> $DIR/union-assignop.rs:24:13 | LL | foo.b = foo.b; | ^^^^^ access to union field diff --git a/tests/ui/unsafe/union-assignop.thirunsafeck.stderr b/tests/ui/unsafe/union-assignop.thirunsafeck.stderr deleted file mode 100644 index 24b357e762bba..0000000000000 --- 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 9a53ef9085200..fbcb846be9d7e 100644 --- a/tests/ui/unsafe/union-modification.rs +++ b/tests/ui/unsafe/union-modification.rs @@ -1,7 +1,4 @@ // run-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - union Foo { bar: i8, _blah: isize, diff --git a/tests/ui/unsafe/union.rs b/tests/ui/unsafe/union.rs index 4338d78eabb9d..83ec1c3cd6cdf 100644 --- a/tests/ui/unsafe/union.rs +++ b/tests/ui/unsafe/union.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - union Foo { bar: i8, zst: (), @@ -29,9 +26,9 @@ pub fn main() { match foo { Foo { bar: _a } => {}, //~ ERROR access to union field is unsafe } - match foo { //[mir]~ ERROR access to union field is unsafe + match foo { //~ ERROR access to union field is unsafe Foo { - pizza: Pizza { //[thir]~ ERROR access to union field is unsafe + pizza: Pizza { topping: Some(PizzaTopping::Cheese) | Some(PizzaTopping::Pineapple) | None } } => {}, @@ -39,10 +36,10 @@ pub fn main() { // MIR unsafeck incorrectly thinks that no unsafe block is needed to do these match foo { - Foo { zst: () } => {}, //[thir]~ ERROR access to union field is unsafe + Foo { zst: () } => {}, } match foo { - Foo { pizza: Pizza { .. } } => {}, //[thir]~ ERROR access to union field is unsafe + Foo { pizza: Pizza { .. } } => {}, } // binding to wildcard is okay diff --git a/tests/ui/unsafe/union.mir.stderr b/tests/ui/unsafe/union.stderr similarity index 92% rename from tests/ui/unsafe/union.mir.stderr rename to tests/ui/unsafe/union.stderr index 787714cdd2ded..fe8144624123e 100644 --- a/tests/ui/unsafe/union.mir.stderr +++ b/tests/ui/unsafe/union.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:30:20 + --> $DIR/union.rs:27:20 | LL | Foo { bar: _a } => {}, | ^^ access to union field @@ -7,7 +7,7 @@ LL | Foo { bar: _a } => {}, = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union.rs:32:11 + --> $DIR/union.rs:29:11 | LL | match foo { | ^^^ access to union field diff --git a/tests/ui/unsafe/union.thir.stderr b/tests/ui/unsafe/union.thir.stderr deleted file mode 100644 index e1a1bd634de6b..0000000000000 --- 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 e4c0976b82659..8b28c33650e5d 100644 --- a/tests/ui/unsafe/union_access_through_block.rs +++ b/tests/ui/unsafe/union_access_through_block.rs @@ -1,7 +1,4 @@ // check-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #[derive(Copy, Clone)] pub struct Foo { a: bool } diff --git a/tests/ui/unsafe/union_destructure.rs b/tests/ui/unsafe/union_destructure.rs index 6c88344b5fdee..85fd54c814574 100644 --- a/tests/ui/unsafe/union_destructure.rs +++ b/tests/ui/unsafe/union_destructure.rs @@ -1,6 +1,4 @@ // run-pass -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck #[derive(Copy, Clone)] #[allow(dead_code)] @@ -32,13 +30,13 @@ fn main() { }; let u = Foo { bar: 9 }; - unsafe { //[mir]~ WARNING unnecessary `unsafe` block + unsafe { //~ WARNING unnecessary `unsafe` block match u { Foo { baz: Pie { .. } } => {}, }; } let u = Foo { bar: 10 }; - unsafe { //[mir]~ WARNING unnecessary `unsafe` block + unsafe { //~ WARNING unnecessary `unsafe` block match u { Foo { baz: Pie { slices: _, size: _ } } => {}, }; diff --git a/tests/ui/unsafe/union_destructure.mir.stderr b/tests/ui/unsafe/union_destructure.stderr similarity index 79% rename from tests/ui/unsafe/union_destructure.mir.stderr rename to tests/ui/unsafe/union_destructure.stderr index 818f5ce03b54d..431521472e832 100644 --- a/tests/ui/unsafe/union_destructure.mir.stderr +++ b/tests/ui/unsafe/union_destructure.stderr @@ -1,5 +1,5 @@ warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:35:5 + --> $DIR/union_destructure.rs:33:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block @@ -7,7 +7,7 @@ LL | unsafe { = note: `#[warn(unused_unsafe)]` on by default warning: unnecessary `unsafe` block - --> $DIR/union_destructure.rs:41:5 + --> $DIR/union_destructure.rs:39:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/unsafe/union_wild_or_wild.rs b/tests/ui/unsafe/union_wild_or_wild.rs index 52a0a7abf274b..935de97f2554d 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 62199e5a2ec0b..0000000000000 --- 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 c1a3276403985..e060c58e408fd 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.thir.stderr b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr similarity index 69% rename from tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr rename to tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr index 62199e5a2ec0b..ffadd90c64b8c 100644 --- a/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr +++ b/tests/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -1,17 +1,17 @@ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:7:9 | LL | unsafe { async {}.await; } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:3:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:13:5 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:11:5 | LL | unsafe { println!("foo"); } | ^^^^^^ unnecessary `unsafe` block diff --git a/tests/ui/unsafe/unsafe-assign.rs b/tests/ui/unsafe/unsafe-assign.rs index 15273165b5e13..02ce238854d87 100644 --- a/tests/ui/unsafe/unsafe-assign.rs +++ b/tests/ui/unsafe/unsafe-assign.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #![allow(unused,dead_code)] diff --git a/tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-assign.stderr similarity index 92% rename from tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr rename to tests/ui/unsafe/unsafe-assign.stderr index f8b55e0668d47..1fa5d715c2e1a 100644 --- a/tests/ui/unsafe/unsafe-assign.mirunsafeck.stderr +++ b/tests/ui/unsafe/unsafe-assign.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-assign.rs:12:5 + --> $DIR/unsafe-assign.rs:9:5 | LL | foo.0.0 = 0; | ^^^^^^^^^^^ mutation of layout constrained field diff --git a/tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr deleted file mode 100644 index f8b55e0668d47..0000000000000 --- a/tests/ui/unsafe/unsafe-assign.thirunsafeck.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-assign.rs:12:5 - | -LL | foo.0.0 = 0; - | ^^^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-borrow.rs b/tests/ui/unsafe/unsafe-borrow.rs index 8dddc70be45c7..ab0e59489a96a 100644 --- a/tests/ui/unsafe/unsafe-borrow.rs +++ b/tests/ui/unsafe/unsafe-borrow.rs @@ -1,6 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - #![feature(rustc_attrs)] #![allow(unused,dead_code)] diff --git a/tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-borrow.stderr similarity index 90% rename from tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr rename to tests/ui/unsafe/unsafe-borrow.stderr index a206722495ac3..a53b50583ca40 100644 --- a/tests/ui/unsafe/unsafe-borrow.mirunsafeck.stderr +++ b/tests/ui/unsafe/unsafe-borrow.stderr @@ -1,5 +1,5 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:12:13 + --> $DIR/unsafe-borrow.rs:9:13 | LL | let a = &mut foo.0.0; | ^^^^^^^^^^^^ mutation of layout constrained field @@ -7,7 +7,7 @@ LL | let a = &mut foo.0.0; = note: mutating layout constrained fields cannot statically be checked for valid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:32:13 + --> $DIR/unsafe-borrow.rs:29:13 | LL | let a = &mut foo.0[2]; | ^^^^^^^^^^^^^ mutation of layout constrained field @@ -15,7 +15,7 @@ LL | let a = &mut foo.0[2]; = note: mutating layout constrained fields cannot statically be checked for valid values error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:51:18 + --> $DIR/unsafe-borrow.rs:48:18 | LL | NonZero((a,)) => *a = 0, | ^ mutation of layout constrained field diff --git a/tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr deleted file mode 100644 index a206722495ac3..0000000000000 --- a/tests/ui/unsafe/unsafe-borrow.thirunsafeck.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:12:13 - | -LL | let a = &mut foo.0.0; - | ^^^^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:32:13 - | -LL | let a = &mut foo.0[2]; - | ^^^^^^^^^^^^^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block - --> $DIR/unsafe-borrow.rs:51:18 - | -LL | NonZero((a,)) => *a = 0, - | ^ mutation of layout constrained field - | - = note: mutating layout constrained fields cannot statically be checked for valid values - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-const-fn.rs b/tests/ui/unsafe/unsafe-const-fn.rs index 65e3acf306372..3b4becf17a76c 100644 --- a/tests/ui/unsafe/unsafe-const-fn.rs +++ b/tests/ui/unsafe/unsafe-const-fn.rs @@ -1,8 +1,5 @@ // A quick test of 'unsafe const fn' functionality -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - const unsafe fn dummy(v: u32) -> u32 { !v } diff --git a/tests/ui/unsafe/unsafe-const-fn.mir.stderr b/tests/ui/unsafe/unsafe-const-fn.stderr similarity index 91% rename from tests/ui/unsafe/unsafe-const-fn.mir.stderr rename to tests/ui/unsafe/unsafe-const-fn.stderr index 2450f08664c98..8d7f09a1edb4c 100644 --- a/tests/ui/unsafe/unsafe-const-fn.mir.stderr +++ b/tests/ui/unsafe/unsafe-const-fn.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-const-fn.rs:10:18 + --> $DIR/unsafe-const-fn.rs:7:18 | LL | const VAL: u32 = dummy(0xFFFF); | ^^^^^^^^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-const-fn.thir.stderr b/tests/ui/unsafe/unsafe-const-fn.thir.stderr deleted file mode 100644 index 199dca9237e15..0000000000000 --- a/tests/ui/unsafe/unsafe-const-fn.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `dummy` is unsafe and requires unsafe function or block - --> $DIR/unsafe-const-fn.rs:10:18 - | -LL | const VAL: u32 = dummy(0xFFFF); - | ^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs index a94e94375ae6a..91264e790c8db 100644 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs +++ b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - fn f(p: *mut u8) { *p = 0; //~ ERROR dereference of raw pointer is unsafe return; diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr similarity index 90% rename from tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr rename to tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr index da3d5f3bd291d..d79cbd466c215 100644 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5 + --> $DIR/unsafe-fn-assign-deref-ptr.rs:2:5 | LL | *p = 0; | ^^^^^^ dereference of raw pointer diff --git a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr b/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr deleted file mode 100644 index aa5644782a41c..0000000000000 --- a/tests/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5 - | -LL | *p = 0; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.rs b/tests/ui/unsafe/unsafe-fn-called-from-safe.rs index 55072dcc6c314..1836629958add 100644 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.rs +++ b/tests/ui/unsafe/unsafe-fn-called-from-safe.rs @@ -1,10 +1,6 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - unsafe fn f() { return; } fn main() { f(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `f` is unsafe + //~^ ERROR call to unsafe function is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr similarity index 88% rename from tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr rename to tests/ui/unsafe/unsafe-fn-called-from-safe.stderr index d334743707550..51aba0ba6d7f8 100644 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-called-from-safe.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-called-from-safe.rs:7:5 + --> $DIR/unsafe-fn-called-from-safe.rs:4:5 | LL | f(); | ^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr b/tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr deleted file mode 100644 index 75431666186ea..0000000000000 --- a/tests/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-called-from-safe.rs:7:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.rs b/tests/ui/unsafe/unsafe-fn-deref-ptr.rs index 4b7c6bf698543..a3144824323d8 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.rs +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - fn f(p: *const u8) -> u8 { let _ = *p; //~ ERROR dereference of raw pointer is unsafe let _: u8 = *p; //~ ERROR dereference of raw pointer is unsafe diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.stderr similarity index 89% rename from tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr rename to tests/ui/unsafe/unsafe-fn-deref-ptr.stderr index 7f1e7c8902f5d..2e68963097e4b 100644 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:5:13 + --> $DIR/unsafe-fn-deref-ptr.rs:2:13 | LL | let _ = *p; | ^^ dereference of raw pointer @@ -7,7 +7,7 @@ LL | let _ = *p; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:6:17 + --> $DIR/unsafe-fn-deref-ptr.rs:3:17 | LL | let _: u8 = *p; | ^^ dereference of raw pointer @@ -15,7 +15,7 @@ LL | let _: u8 = *p; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:7:9 + --> $DIR/unsafe-fn-deref-ptr.rs:4:9 | LL | _ = *p; | ^^ dereference of raw pointer @@ -23,7 +23,7 @@ LL | _ = *p; = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:8:12 + --> $DIR/unsafe-fn-deref-ptr.rs:5:12 | LL | return *p; | ^^ dereference of raw pointer diff --git a/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr b/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr deleted file mode 100644 index 7f1e7c8902f5d..0000000000000 --- a/tests/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:5:13 - | -LL | let _ = *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:6:17 - | -LL | let _: u8 = *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:7:9 - | -LL | _ = *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:8:12 - | -LL | return *p; - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.rs b/tests/ui/unsafe/unsafe-fn-used-as-value.rs index 9517598c7ce57..a47189d265fcf 100644 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.rs +++ b/tests/ui/unsafe/unsafe-fn-used-as-value.rs @@ -1,11 +1,7 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - unsafe fn f() { return; } fn main() { let x = f; x(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `f` is unsafe + //~^ ERROR call to unsafe function is unsafe } diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.stderr similarity index 89% rename from tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr rename to tests/ui/unsafe/unsafe-fn-used-as-value.stderr index 01e8e49ecfafd..1625de184d2ad 100644 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.mir.stderr +++ b/tests/ui/unsafe/unsafe-fn-used-as-value.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-used-as-value.rs:8:5 + --> $DIR/unsafe-fn-used-as-value.rs:5:5 | LL | x(); | ^^^ call to unsafe function diff --git a/tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr b/tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr deleted file mode 100644 index c38da7226f615..0000000000000 --- a/tests/ui/unsafe/unsafe-fn-used-as-value.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-used-as-value.rs:8:5 - | -LL | x(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-not-inherited.rs b/tests/ui/unsafe/unsafe-not-inherited.rs index f9d9a5957141c..6d797caa0f94d 100644 --- a/tests/ui/unsafe/unsafe-not-inherited.rs +++ b/tests/ui/unsafe/unsafe-not-inherited.rs @@ -1,5 +1,3 @@ -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck #![allow(unused, dead_code)] static mut FOO: u64 = 0; diff --git a/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr b/tests/ui/unsafe/unsafe-not-inherited.stderr similarity index 91% rename from tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr rename to tests/ui/unsafe/unsafe-not-inherited.stderr index 5536efbc6f41f..3bc5ca5c9d151 100644 --- a/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr +++ b/tests/ui/unsafe/unsafe-not-inherited.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:8:31 + --> $DIR/unsafe-not-inherited.rs:6:31 | LL | unsafe {static BAR: u64 = FOO;} | ------ ^^^ use of mutable static @@ -9,7 +9,7 @@ LL | unsafe {static BAR: u64 = FOO;} = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:20:13 + --> $DIR/unsafe-not-inherited.rs:18:13 | LL | unsafe { | ------ items do not inherit unsafety from separate enclosing items diff --git a/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr deleted file mode 100644 index 88ea2e6d1fee6..0000000000000 --- a/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:8:31 - | -LL | unsafe {static BAR: u64 = FOO;} - | ------ ^^^ use of mutable static - | | - | items do not inherit unsafety from separate enclosing items - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: call to unsafe function `unsafe_call` is unsafe and requires unsafe function or block - --> $DIR/unsafe-not-inherited.rs:20:13 - | -LL | unsafe { - | ------ items do not inherit unsafety from separate enclosing items -... -LL | unsafe_call(); - | ^^^^^^^^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/unsafe-unstable-const-fn.rs b/tests/ui/unsafe/unsafe-unstable-const-fn.rs index 581b15cdfb0cd..5398721484a01 100644 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.rs +++ b/tests/ui/unsafe/unsafe-unstable-const-fn.rs @@ -1,6 +1,3 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - #![stable(feature = "foo", since = "1.33.0")] #![feature(staged_api)] diff --git a/tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr b/tests/ui/unsafe/unsafe-unstable-const-fn.stderr similarity index 90% rename from tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr rename to tests/ui/unsafe/unsafe-unstable-const-fn.stderr index 79133ab39a0c0..22a2dcbf11997 100644 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.mir.stderr +++ b/tests/ui/unsafe/unsafe-unstable-const-fn.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-unstable-const-fn.rs:10:5 + --> $DIR/unsafe-unstable-const-fn.rs:7:5 | LL | *a == b | ^^ dereference of raw pointer diff --git a/tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr b/tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr deleted file mode 100644 index 79133ab39a0c0..0000000000000 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.thir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-unstable-const-fn.rs:10:5 - | -LL | *a == b - | ^^ dereference of raw pointer - | - = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed similarity index 75% rename from tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed rename to tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed index b59029df6429b..f776cffed5932 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed @@ -1,7 +1,5 @@ // run-rustfix // aux-build:external_unsafe_macro.rs -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![deny(unsafe_op_in_unsafe_fn)] //~ NOTE #![crate_name = "wrapping_unsafe_block_sugg"] @@ -12,13 +10,11 @@ unsafe fn unsf() {} pub unsafe fn foo() { unsafe { //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE }} @@ -44,12 +40,10 @@ pub unsafe fn baz() -> i32 { unsafe { }} macro_rules! unsafe_macro { () => (unsf()) } -//[mir]~^ ERROR call to unsafe function is unsafe -//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe +//~^ ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE -//[mir]~| ERROR call to unsafe function is unsafe -//[thir]~| ERROR call to unsafe function `unsf` is unsafe +//~| ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs index 3629b8a1beb5f..13ab51ef4325a 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs @@ -1,7 +1,5 @@ // run-rustfix // aux-build:external_unsafe_macro.rs -// revisions: mir thir -// [thir]compile-flags: -Zthir-unsafeck #![deny(unsafe_op_in_unsafe_fn)] //~ NOTE #![crate_name = "wrapping_unsafe_block_sugg"] @@ -12,13 +10,11 @@ unsafe fn unsf() {} pub unsafe fn foo() { //~^ NOTE an unsafe function restricts its caller, but its body is safe by default - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE - unsf(); //[mir]~ ERROR call to unsafe function is unsafe - //[thir]~^ ERROR call to unsafe function `unsf` is unsafe - //~^^ NOTE + unsf(); //~ ERROR call to unsafe function is unsafe + //~^ NOTE //~| NOTE } @@ -44,12 +40,10 @@ pub unsafe fn baz() -> i32 { } macro_rules! unsafe_macro { () => (unsf()) } -//[mir]~^ ERROR call to unsafe function is unsafe -//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe +//~^ ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE -//[mir]~| ERROR call to unsafe function is unsafe -//[thir]~| ERROR call to unsafe function `unsf` is unsafe +//~| ERROR call to unsafe function is unsafe //~| NOTE //~| NOTE diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr similarity index 85% rename from tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr rename to tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr index 7a1b83c7367da..9ae238d5a7973 100644 --- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr +++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr @@ -1,23 +1,23 @@ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:15:5 + --> $DIR/wrapping-unsafe-block-sugg.rs:13:5 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:13:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:11:1 | LL | pub unsafe fn foo() { | ^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/wrapping-unsafe-block-sugg.rs:6:9 + --> $DIR/wrapping-unsafe-block-sugg.rs:4:9 | LL | #![deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:19:5 + --> $DIR/wrapping-unsafe-block-sugg.rs:16:5 | LL | unsf(); | ^^^^^^ call to unsafe function @@ -25,20 +25,20 @@ LL | unsf(); = note: consult the function's documentation for information on how to avoid undefined behavior error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:27:13 + --> $DIR/wrapping-unsafe-block-sugg.rs:23:13 | LL | let y = *x; | ^^ dereference of raw pointer | = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:25:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:21:1 | LL | pub unsafe fn bar(x: *const i32) -> i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: dereference of raw pointer is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:30:9 + --> $DIR/wrapping-unsafe-block-sugg.rs:26:9 | LL | y + *x | ^^ dereference of raw pointer @@ -46,20 +46,20 @@ LL | y + *x = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:38:13 + --> $DIR/wrapping-unsafe-block-sugg.rs:34:13 | LL | let y = BAZ; | ^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:36:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:32:1 | LL | pub unsafe fn baz() -> i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of mutable static is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:41:9 + --> $DIR/wrapping-unsafe-block-sugg.rs:37:9 | LL | y + BAZ | ^^^ use of mutable static @@ -67,7 +67,7 @@ LL | y + BAZ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:46:36 + --> $DIR/wrapping-unsafe-block-sugg.rs:42:36 | LL | macro_rules! unsafe_macro { () => (unsf()) } | ^^^^^^ call to unsafe function @@ -77,14 +77,14 @@ LL | unsafe_macro!(); | = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/wrapping-unsafe-block-sugg.rs:56:1 + --> $DIR/wrapping-unsafe-block-sugg.rs:50:1 | LL | pub unsafe fn unsafe_in_macro() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: call to unsafe function is unsafe and requires unsafe block (error E0133) - --> $DIR/wrapping-unsafe-block-sugg.rs:46:36 + --> $DIR/wrapping-unsafe-block-sugg.rs:42:36 | LL | macro_rules! unsafe_macro { () => (unsf()) } | ^^^^^^ call to unsafe function diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed deleted file mode 100644 index b59029df6429b..0000000000000 --- 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 b1fb35f85a606..0000000000000 --- 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 - From 26f48b4cba17a6f7d321bccaa86b345596923763 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 7 Dec 2023 11:56:48 +0000 Subject: [PATCH 2/3] 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 +- .../rustc_mir_build/src/check_unsafety.rs | 9 +- compiler/rustc_mir_build/src/lib.rs | 2 +- .../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 +- .../async-unsafe-fn-call-in-safe.rs | 8 +- .../async-unsafe-fn-call-in-safe.stderr | 8 +- .../binding/issue-53114-safety-checks.stderr | 144 +++++++++--------- ...rce-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 +- .../intrinsics/unchecked_math_unsafe.stderr | 6 +- tests/ui/issues/issue-28776.stderr | 2 +- tests/ui/issues/issue-5844.stderr | 2 +- .../ui/lifetimes/issue-76168-hr-outlives-3.rs | 5 +- .../issue-76168-hr-outlives-3.stderr | 25 +-- tests/ui/pattern/usefulness/issue-57472.rs | 12 +- .../ui/pattern/usefulness/issue-57472.stderr | 6 +- .../rfc-2396-target_feature-11/safe-calls.rs | 24 +-- .../safe-calls.stderr | 24 +-- .../ui/static/safe-extern-statics-mut.stderr | 8 +- tests/ui/static/safe-extern-statics.stderr | 8 +- .../static-mut-foreign-requires-unsafe.stderr | 4 +- .../static/static-mut-requires-unsafe.stderr | 4 +- .../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 +- .../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 +- .../ui/unsafe/foreign-unsafe-fn-called.stderr | 2 +- tests/ui/unsafe/issue-3080.stderr | 2 +- .../issue-45087-unreachable-unsafe.stderr | 6 +- ...45107-unnecessary-unsafe-in-closure.stderr | 6 +- tests/ui/unsafe/ranged_ints2_const.stderr | 16 +- tests/ui/unsafe/ranged_ints3_const.stderr | 16 +- .../unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs | 8 +- .../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 +- .../unsafe/unsafe-fn-assign-deref-ptr.stderr | 2 +- tests/ui/unsafe/unsafe-fn-called-from-safe.rs | 6 +- .../unsafe/unsafe-fn-called-from-safe.stderr | 4 +- tests/ui/unsafe/unsafe-fn-used-as-value.rs | 6 +- .../ui/unsafe/unsafe-fn-used-as-value.stderr | 4 +- tests/ui/unsafe/unsafe-not-inherited.stderr | 2 +- .../unsafe/wrapping-unsafe-block-sugg.fixed | 8 +- tests/ui/unsafe/wrapping-unsafe-block-sugg.rs | 8 +- .../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 559874641c3d5..ce76c2cba939c 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 c4a1f3a0e510b..75410db1e364c 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 5c425fef27ebc..0a1a72b442a02 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 2810182c0a0dc..bf5e59ba78d13 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 2e8b6c19ec784..7d0ce53997a73 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 a776e917de57a..430c4ee3da780 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 d94d96c1115ca..582c2c0c6b60b 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 5562ae7f3bdef..164b6b9c4f5cc 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 8274fd05bc057..0b0b67ef890b0 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 dfa386b49de7c..b4745d4883c55 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 f7e9e96bff700..7695853000d79 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 89c496c598d1c..b25794c089235 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 349c4639a9e2d..b7d805d91718b 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 75c379c88e3d8..f5cb3e2b5f807 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 896d4b376fdae..95fb9ef42603a 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 5196b8ee0a21d..6f59b2f205537 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 afb344f5e857b..834ffa8d3a0ee 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 d0f200b83609d..19949b4293962 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 a1ae6cb7fc903..5e3e49fb64478 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 be748b47d4d16..94ff21319939a 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 ebd18f89d9c94..45f850d1f99bf 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 4066cf8efb8c1..31da1a86ca135 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 9f0f10335abbe..3db94ee181017 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 af7bfb0332029..bae917fa72c5d 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 b0b6b318d8f78..782c38200a06f 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 5b77051dc8872..89ebdb57f3c31 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 1131006374c64..17c252de2be09 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 26efdf6dbaf34..c814eaec0d19e 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 b420d14d1e175..788c79adc1fd9 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 3897f09b57661..e17859eb40f27 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 3880388341445..e390625f20a98 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 b42572ea3eeb5..6be6c074c2611 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 e7ed0b710b2f3..022f7e9fb1655 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 85e468b333c28..30be0220cf65a 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 f37fd9db36d6e..c1777dd60db68 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 996abb4809a4a..671b45e777f84 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 9090fd0a4a6fd..9b13646a22852 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 284e73f572d24..7a8e6c81a220a 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 404e376e364e0..94113b336c330 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 4d3408a89af29..82b3f897167c7 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 3d2e699f630b4..851ad8939d49b 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 9e150326f0bb3..f84f12c8301d7 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 9ca10b0509032..1187c2d80f388 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 abbe462021ed7..b5065beb5fcb8 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 b55e6130230d2..cf2d4c493a19b 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 f84ba20463918..913a601049e32 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 cc1e73bb93288..d6cc5fd2e0831 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 321698e763696..b23c002dc6532 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 a0dc950e76dd1..f267dc6e23e48 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 215005571f6d7..75b36cdf94bf9 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 eceac115eddd2..658d14da829dc 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 d61d87cd00146..ea0659b2e104d 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 e3a673ee1ff8e..6b2ebfb509961 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 83ec1c3cd6cdf..ae81708aa191c 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 fe8144624123e..1506bdb919bda 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 85fd54c814574..d0cf8640eaa22 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 431521472e832..0000000000000 --- 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 8d7f09a1edb4c..5a6e6b7ce5970 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 d79cbd466c215..3a0874f32c0d2 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 1836629958add..758b80097f735 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 51aba0ba6d7f8..1b1c92f0546fd 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 a47189d265fcf..99506ea047c69 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 1625de184d2ad..0542b87b5e6bc 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 3bc5ca5c9d151..8b6991273129a 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 f776cffed5932..20f4fe847daca 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 13ab51ef4325a..13a446d2d2480 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 9ae238d5a7973..84b58bc028858 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()) } From 7832ebbd4ff090aced6e338ff92e1353bbe88f76 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 22 Dec 2023 16:38:20 +0000 Subject: [PATCH 3/3] Handle context for const patterns correctly --- .../rustc_mir_build/src/check_unsafety.rs | 8 ++++++- .../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 7d0ce53997a73..b4a02fae4544b 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 0000000000000..5bc7a7113e4f6 --- /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 + }, + ) => (), + _ => (), + } +}