From a277c901d95c5fcbb3dbd6608731eebb9e1a01ce Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Tue, 27 Feb 2024 11:57:52 +0000 Subject: [PATCH] Remove MIR unsafe check This also remove safety information from MIR. --- compiler/rustc_interface/src/passes.rs | 3 - compiler/rustc_interface/src/tests.rs | 1 - compiler/rustc_middle/src/arena.rs | 1 - compiler/rustc_middle/src/mir/mod.rs | 15 +- compiler/rustc_middle/src/mir/query.rs | 63 -- compiler/rustc_middle/src/query/mod.rs | 6 - compiler/rustc_middle/src/ty/codec.rs | 1 - compiler/rustc_mir_build/src/build/block.rs | 45 +- .../rustc_mir_build/src/build/custom/mod.rs | 5 +- .../src/build/expr/as_rvalue.rs | 15 +- .../rustc_mir_build/src/build/expr/into.rs | 2 +- .../rustc_mir_build/src/build/matches/mod.rs | 2 +- compiler/rustc_mir_build/src/build/mod.rs | 52 +- compiler/rustc_mir_build/src/build/scope.rs | 18 +- .../rustc_mir_build/src/check_unsafety.rs | 5 - compiler/rustc_mir_transform/messages.ftl | 49 -- .../rustc_mir_transform/src/check_unsafety.rs | 615 ------------------ compiler/rustc_mir_transform/src/errors.rs | 171 +---- compiler/rustc_mir_transform/src/lib.rs | 7 - compiler/rustc_session/src/options.rs | 2 - .../incremental/hashes/function_interfaces.rs | 6 +- tests/incremental/hashes/inherent_impls.rs | 8 +- ...fg-pre-optimizations.after.panic-abort.mir | 2 - ...g-pre-optimizations.after.panic-unwind.mir | 2 - ...c_abort.main.AbortUnwindingCalls.after.mir | 2 - .../mir-opt/box_expr.main.ElaborateDrops.diff | 2 - ...await.b-{closure#0}.coroutine_resume.0.mir | 8 +- ...e_out.move_out_by_subslice.built.after.mir | 6 +- ...move_out.move_out_from_end.built.after.mir | 6 +- ...motion_extern_static.FOO.PromoteTemps.diff | 2 - .../const_prop/address_of_pair.fn0.GVN.diff | 2 - ...for_slices.main.GVN.32bit.panic-abort.diff | 6 +- ...or_slices.main.GVN.32bit.panic-unwind.diff | 6 +- ...for_slices.main.GVN.64bit.panic-abort.diff | 6 +- ...or_slices.main.GVN.64bit.panic-unwind.diff | 6 +- .../boxes.main.GVN.panic-abort.diff | 2 - .../boxes.main.GVN.panic-unwind.diff | 2 - .../const_prop/indirect_mutation.bar.GVN.diff | 2 - .../const_prop/invalid_constant.main.GVN.diff | 12 +- .../invalid_constant.main.RemoveZsts.diff | 12 +- .../mutable_variable_no_prop.main.GVN.diff | 2 - .../transmute.from_char.GVN.32bit.diff | 2 - .../transmute.from_char.GVN.64bit.diff | 2 - .../transmute.invalid_bool.GVN.32bit.diff | 2 - .../transmute.invalid_bool.GVN.64bit.diff | 2 - .../transmute.invalid_char.GVN.32bit.diff | 2 - .../transmute.invalid_char.GVN.64bit.diff | 2 - .../transmute.less_as_i8.GVN.32bit.diff | 2 - .../transmute.less_as_i8.GVN.64bit.diff | 2 - ...mute.undef_union_as_integer.GVN.32bit.diff | 2 - ...mute.undef_union_as_integer.GVN.64bit.diff | 2 - .../transmute.unreachable_box.GVN.32bit.diff | 2 - .../transmute.unreachable_box.GVN.64bit.diff | 2 - ...ransmute.unreachable_direct.GVN.32bit.diff | 2 - ...ransmute.unreachable_direct.GVN.64bit.diff | 2 - .../transmute.unreachable_mut.GVN.32bit.diff | 2 - .../transmute.unreachable_mut.GVN.64bit.diff | 2 - .../transmute.unreachable_ref.GVN.32bit.diff | 2 - .../transmute.unreachable_ref.GVN.64bit.diff | 2 - .../transmute.valid_char.GVN.32bit.diff | 2 - .../transmute.valid_char.GVN.64bit.diff | 2 - ...reborrow.demiraw.CopyProp.panic-abort.diff | 4 +- ...eborrow.demiraw.CopyProp.panic-unwind.diff | 4 +- .../reborrow.miraw.CopyProp.panic-abort.diff | 4 +- .../reborrow.miraw.CopyProp.panic-unwind.diff | 4 +- ...n.DataflowConstProp.32bit.panic-abort.diff | 38 +- ....DataflowConstProp.32bit.panic-unwind.diff | 38 +- ...n.DataflowConstProp.64bit.panic-abort.diff | 38 +- ....DataflowConstProp.64bit.panic-unwind.diff | 38 +- ...oxed_slice.main.GVN.32bit.panic-abort.diff | 38 +- ...xed_slice.main.GVN.32bit.panic-unwind.diff | 38 +- ...oxed_slice.main.GVN.64bit.panic-abort.diff | 38 +- ...xed_slice.main.GVN.64bit.panic-unwind.diff | 38 +- ...tr.main.DataflowConstProp.panic-abort.diff | 8 +- ...r.main.DataflowConstProp.panic-unwind.diff | 8 +- ...ute.from_char.DataflowConstProp.32bit.diff | 2 - ...ute.from_char.DataflowConstProp.64bit.diff | 2 - ....invalid_bool.DataflowConstProp.32bit.diff | 2 - ....invalid_bool.DataflowConstProp.64bit.diff | 2 - ....invalid_char.DataflowConstProp.32bit.diff | 2 - ....invalid_char.DataflowConstProp.64bit.diff | 2 - ...te.less_as_i8.DataflowConstProp.32bit.diff | 2 - ...te.less_as_i8.DataflowConstProp.64bit.diff | 2 - ...on_as_integer.DataflowConstProp.32bit.diff | 2 - ...on_as_integer.DataflowConstProp.64bit.diff | 2 - ...reachable_box.DataflowConstProp.32bit.diff | 2 - ...reachable_box.DataflowConstProp.64bit.diff | 2 - ...chable_direct.DataflowConstProp.32bit.diff | 2 - ...chable_direct.DataflowConstProp.64bit.diff | 2 - ...reachable_mut.DataflowConstProp.32bit.diff | 2 - ...reachable_mut.DataflowConstProp.64bit.diff | 2 - ...reachable_ref.DataflowConstProp.32bit.diff | 2 - ...reachable_ref.DataflowConstProp.64bit.diff | 2 - ...te.valid_char.DataflowConstProp.32bit.diff | 2 - ...te.valid_char.DataflowConstProp.64bit.diff | 2 - ...in.DestinationPropagation.panic-abort.diff | 6 +- ...n.DestinationPropagation.panic-unwind.diff | 6 +- .../gvn.dereferences.GVN.panic-abort.diff | 10 +- .../gvn.dereferences.GVN.panic-unwind.diff | 10 +- tests/mir-opt/gvn.slices.GVN.panic-abort.diff | 6 +- .../mir-opt/gvn.slices.GVN.panic-unwind.diff | 6 +- ...xpression_elimination.GVN.panic-abort.diff | 12 +- ...pression_elimination.GVN.panic-unwind.diff | 12 +- .../gvn.wide_ptr_integer.GVN.panic-abort.diff | 6 +- ...gvn.wide_ptr_integer.GVN.panic-unwind.diff | 6 +- .../gvn_uninhabited.f.GVN.panic-abort.diff | 4 +- .../gvn_uninhabited.f.GVN.panic-unwind.diff | 4 +- .../asm_unwind.main.Inline.panic-unwind.diff | 2 - ...ine_coroutine.main.Inline.panic-abort.diff | 8 +- ...ne_coroutine.main.Inline.panic-unwind.diff | 8 +- ...inline_instruction_set.default.Inline.diff | 2 - .../inline_shims.drop.Inline.panic-abort.diff | 20 +- ...inline_shims.drop.Inline.panic-unwind.diff | 12 +- ...l_unsigned_smaller.Inline.panic-abort.diff | 2 - ..._unsigned_smaller.Inline.panic-unwind.diff | 2 - ...d_smaller.PreCodegen.after.panic-abort.mir | 2 - ..._smaller.PreCodegen.after.panic-unwind.mir | 2 - ..._shr_signed_bigger.Inline.panic-abort.diff | 2 - ...shr_signed_bigger.Inline.panic-unwind.diff | 2 - ...ed_bigger.PreCodegen.after.panic-abort.mir | 2 - ...d_bigger.PreCodegen.after.panic-unwind.mir | 2 - ...d.unwrap_unchecked.Inline.panic-abort.diff | 14 +- ....unwrap_unchecked.Inline.panic-unwind.diff | 14 +- ...unchecked.PreCodegen.after.panic-abort.mir | 10 +- ...nchecked.PreCodegen.after.panic-unwind.mir | 10 +- ...y.run2-{closure#0}.Inline.panic-abort.diff | 24 +- ....run2-{closure#0}.Inline.panic-unwind.diff | 24 +- ...b_check.unwrap_unchecked.InstSimplify.diff | 28 +- ....AbortUnwindingCalls.after.panic-abort.mir | 2 - ...AbortUnwindingCalls.after.panic-unwind.mir | 2 - ...test.ElaborateDrops.before.panic-abort.mir | 8 +- ...est.ElaborateDrops.before.panic-unwind.mir | 8 +- .../mir-opt/issue_72181.main.built.after.mir | 2 - .../issue_72181_1.main.built.after.mir | 2 - ...e_75439.foo.MatchBranchSimplification.diff | 6 +- ...mutable_ref.JumpThreading.panic-abort.diff | 2 - ...utable_ref.JumpThreading.panic-unwind.diff | 2 - ...len_raw.NormalizeArrayLen.panic-abort.diff | 2 - ...en_raw.NormalizeArrayLen.panic-unwind.diff | 2 - ...cs.assume.LowerIntrinsics.panic-abort.diff | 2 - ...s.assume.LowerIntrinsics.panic-unwind.diff | 2 - ...erlapping.LowerIntrinsics.panic-abort.diff | 2 - ...rlapping.LowerIntrinsics.panic-unwind.diff | 2 - ...primitive.LowerIntrinsics.panic-abort.diff | 2 - ...rimitive.LowerIntrinsics.panic-unwind.diff | 2 - ...inhabited.LowerIntrinsics.panic-abort.diff | 2 - ...nhabited.LowerIntrinsics.panic-unwind.diff | 2 - ...inhabited.LowerIntrinsics.panic-abort.diff | 2 - ...nhabited.LowerIntrinsics.panic-unwind.diff | 2 - ...e_ref_dst.LowerIntrinsics.panic-abort.diff | 2 - ..._ref_dst.LowerIntrinsics.panic-unwind.diff | 2 - ...inhabited.LowerIntrinsics.panic-abort.diff | 2 - ...nhabited.LowerIntrinsics.panic-unwind.diff | 2 - ...reachable.LowerIntrinsics.panic-abort.diff | 2 - ...eachable.LowerIntrinsics.panic-unwind.diff | 2 - ...ve_string.LowerIntrinsics.panic-abort.diff | 2 - ...e_string.LowerIntrinsics.panic-unwind.diff | 2 - ...ecked_ops.checked_shl.PreCodegen.after.mir | 10 +- ...witch_targets.ub_if_b.PreCodegen.after.mir | 6 +- .../loops.int_range.PreCodegen.after.mir | 4 +- ...m_replace.PreCodegen.after.panic-abort.mir | 20 +- ..._replace.PreCodegen.after.panic-unwind.mir | 20 +- ...ward_loop.PreCodegen.after.panic-abort.mir | 4 +- ...ard_loop.PreCodegen.after.panic-unwind.mir | 4 +- ...iter_next.PreCodegen.after.panic-abort.mir | 4 +- ...ter_next.PreCodegen.after.panic-unwind.mir | 4 +- ...mut_range.PreCodegen.after.panic-abort.mir | 2 - ...ut_range.PreCodegen.after.panic-unwind.mir | 2 - ...ated_loop.PreCodegen.after.panic-abort.mir | 48 +- ...ted_loop.PreCodegen.after.panic-unwind.mir | 48 +- ...ward_loop.PreCodegen.after.panic-abort.mir | 44 +- ...ard_loop.PreCodegen.after.panic-unwind.mir | 44 +- ...ange_loop.PreCodegen.after.panic-abort.mir | 4 +- ...nge_loop.PreCodegen.after.panic-unwind.mir | 4 +- ...erse_loop.PreCodegen.after.panic-abort.mir | 50 +- ...rse_loop.PreCodegen.after.panic-unwind.mir | 50 +- ...raw_then_mut_shr.ReferencePropagation.diff | 2 - ...gation_const_ptr.ReferencePropagation.diff | 268 ++++---- ...pagation_mut_ptr.ReferencePropagation.diff | 238 ++++--- ...ique_with_copies.ReferencePropagation.diff | 4 - ...fg-pre-optimizations.after.panic-abort.mir | 10 +- ...g-pre-optimizations.after.panic-unwind.mir | 10 +- ...s.t1.SimplifyLocals-before-const-prop.diff | 2 - ...s.t2.SimplifyLocals-before-const-prop.diff | 2 - ...s.t3.SimplifyLocals-before-const-prop.diff | 2 - ...s.t4.SimplifyLocals-before-const-prop.diff | 2 - ....unions.ScalarReplacementOfAggregates.diff | 2 - .../tls_access.main.PreCodegen.after.mir | 6 +- ...ocess_never.SimplifyLocals-final.after.mir | 2 - ...rocess_void.SimplifyLocals-final.after.mir | 2 - ...d_access.bar.SimplifyCfg-initial.after.mir | 2 - tests/ui/asm/x86_64/goto.rs | 2 - .../{goto.mirunsafeck.stderr => goto.stderr} | 4 +- tests/ui/asm/x86_64/goto.thirunsafeck.stderr | 23 - 194 files changed, 667 insertions(+), 2238 deletions(-) delete mode 100644 compiler/rustc_mir_transform/src/check_unsafety.rs rename tests/ui/asm/x86_64/{goto.mirunsafeck.stderr => goto.stderr} (92%) delete mode 100644 tests/ui/asm/x86_64/goto.thirunsafeck.stderr diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index d763a12f816..1f92cc4d763 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -748,9 +748,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { sess.time("MIR_effect_checking", || { for def_id in tcx.hir().body_owners() { - if !tcx.sess.opts.unstable_opts.thir_unsafeck { - rustc_mir_transform::check_unsafety::check_unsafety(tcx, def_id); - } tcx.ensure().has_ffi_unwind_calls(def_id); // If we need to codegen, ensure that we emit all errors from diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 3b78e6a43ab..b9025917d13 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -840,7 +840,6 @@ macro_rules! tracked { tracked!(stack_protector, StackProtector::All); tracked!(teach, true); tracked!(thinlto, Some(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/arena.rs b/compiler/rustc_middle/src/arena.rs index c90427256b8..bd11b3eb04c 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -35,7 +35,6 @@ macro_rules! arena_types { )>, [] crate_for_resolver: rustc_data_structures::steal::Steal<(rustc_ast::Crate, rustc_ast::AttrVec)>, [] resolutions: rustc_middle::ty::ResolverGlobalCtxt, - [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult, [decode] code_region: rustc_middle::mir::coverage::CodeRegion, [] const_allocs: rustc_middle::mir::interpret::Allocation, [] region_scope_tree: rustc_middle::middle::region::ScopeTree, diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index e5a650c5ac4..b87e9ee60be 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -845,17 +845,6 @@ pub fn caller_location_span( } } -#[derive(Copy, Clone, PartialEq, Eq, Debug, TyEncodable, TyDecodable, HashStable)] -pub enum Safety { - Safe, - /// Unsafe because of compiler-generated unsafe code, like `await` desugaring - BuiltinUnsafe, - /// Unsafe because of an unsafe fn - FnUnsafe, - /// Unsafe because of an `unsafe` block - ExplicitUnsafe(hir::HirId), -} - impl<'tcx> Index for Body<'tcx> { type Output = BasicBlockData<'tcx>; @@ -1611,8 +1600,6 @@ pub struct SourceScopeData<'tcx> { pub struct SourceScopeLocalData { /// An `HirId` with lint levels equivalent to this scope's lint levels. pub lint_root: hir::HirId, - /// The unsafe block that contains this node. - pub safety: Safety, } /// A collection of projections into user types. @@ -1888,7 +1875,7 @@ mod size_asserts { // tidy-alphabetical-start static_assert_size!(BasicBlockData<'_>, 144); static_assert_size!(LocalDecl<'_>, 40); - static_assert_size!(SourceScopeData<'_>, 72); + static_assert_size!(SourceScopeData<'_>, 64); static_assert_size!(Statement<'_>, 32); static_assert_size!(StatementKind<'_>, 16); static_assert_size!(Terminator<'_>, 112); diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 731e050ca9b..d286c208083 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -3,9 +3,7 @@ use crate::mir; use crate::ty::{self, OpaqueHiddenType, Ty, TyCtxt}; use rustc_data_structures::fx::FxIndexMap; -use rustc_data_structures::unord::UnordSet; use rustc_errors::ErrorGuaranteed; -use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; use rustc_index::bit_set::BitMatrix; use rustc_index::{Idx, IndexVec}; @@ -18,67 +16,6 @@ use super::{ConstValue, SourceInfo}; -#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)] -pub enum UnsafetyViolationKind { - /// Unsafe operation outside `unsafe`. - General, - /// Unsafe operation in an `unsafe fn` but outside an `unsafe` block. - /// Has to be handled as a lint for backwards compatibility. - UnsafeFn, -} - -#[derive(Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)] -pub enum UnsafetyViolationDetails { - CallToUnsafeFunction, - UseOfInlineAssembly, - InitializingTypeWith, - CastOfPointerToInt, - UseOfMutableStatic, - UseOfExternStatic, - DerefOfRawPointer, - AccessToUnionField, - MutationOfLayoutConstrainedField, - BorrowOfLayoutConstrainedField, - CallToFunctionWith { - /// Target features enabled in callee's `#[target_feature]` but missing in - /// caller's `#[target_feature]`. - missing: Vec, - /// Target features in `missing` that are enabled at compile time - /// (e.g., with `-C target-feature`). - build_enabled: Vec, - }, -} - -#[derive(Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)] -pub struct UnsafetyViolation { - pub source_info: SourceInfo, - pub lint_root: hir::HirId, - pub kind: UnsafetyViolationKind, - pub details: UnsafetyViolationDetails, -} - -#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)] -pub enum UnusedUnsafe { - /// `unsafe` block contains no unsafe operations - /// > ``unnecessary `unsafe` block`` - Unused, - /// `unsafe` block nested under another (used) `unsafe` block - /// > ``… because it's nested under this `unsafe` block`` - InUnsafeBlock(hir::HirId), -} - -#[derive(TyEncodable, TyDecodable, HashStable, Debug)] -pub struct UnsafetyCheckResult { - /// Violations that are propagated *upwards* from this function. - pub violations: Vec, - - /// Used `unsafe` blocks in this function. This is used for the "unused_unsafe" lint. - pub used_unsafe_blocks: UnordSet, - - /// This is `Some` iff the item is not a closure. - pub unused_unsafes: Option>, -} - rustc_index::newtype_index! { #[derive(HashStable)] #[encodable] diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 5e4454db3e2..62a60a650ec 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -877,12 +877,6 @@ desc { |tcx| "collecting all inherent impls for `{:?}`", key } } - /// 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`. query check_unsafety(key: LocalDefId) { desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) } diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index ddbc0bffaed..e7a1679b151 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -458,7 +458,6 @@ fn decode(decoder: &mut D) -> &'tcx Self { &'tcx ty::List>, &'tcx traits::ImplSource<'tcx, ()>, &'tcx mir::Body<'tcx>, - &'tcx mir::UnsafetyCheckResult, &'tcx mir::BorrowCheckResult<'tcx>, &'tcx mir::coverage::CodeRegion, &'tcx ty::List, diff --git a/compiler/rustc_mir_build/src/build/block.rs b/compiler/rustc_mir_build/src/build/block.rs index 6200f4bda6b..00e99f330f7 100644 --- a/compiler/rustc_mir_build/src/build/block.rs +++ b/compiler/rustc_mir_build/src/build/block.rs @@ -13,31 +13,15 @@ pub(crate) fn ast_block( ast_block: BlockId, source_info: SourceInfo, ) -> BlockAnd<()> { - let Block { region_scope, span, ref stmts, expr, targeted_by_break, safety_mode } = + let Block { region_scope, span, ref stmts, expr, targeted_by_break, safety_mode: _ } = self.thir[ast_block]; self.in_scope((region_scope, source_info), LintLevel::Inherited, move |this| { if targeted_by_break { this.in_breakable_scope(None, destination, span, |this| { - Some(this.ast_block_stmts( - destination, - block, - span, - stmts, - expr, - safety_mode, - region_scope, - )) + Some(this.ast_block_stmts(destination, block, span, stmts, expr, region_scope)) }) } else { - this.ast_block_stmts( - destination, - block, - span, - stmts, - expr, - safety_mode, - region_scope, - ) + this.ast_block_stmts(destination, block, span, stmts, expr, region_scope) } }) } @@ -49,7 +33,6 @@ fn ast_block_stmts( span: Span, stmts: &[StmtId], expr: Option, - safety_mode: BlockSafety, region_scope: Scope, ) -> BlockAnd<()> { let this = self; @@ -72,13 +55,11 @@ fn ast_block_stmts( // First we build all the statements in the block. let mut let_scope_stack = Vec::with_capacity(8); let outer_source_scope = this.source_scope; - let outer_in_scope_unsafe = this.in_scope_unsafe; // This scope information is kept for breaking out of the parent remainder scope in case // one let-else pattern matching fails. // By doing so, we can be sure that even temporaries that receive extended lifetime // assignments are dropped, too. let mut last_remainder_scope = region_scope; - this.update_source_scope_for_safety_mode(span, safety_mode); let source_info = this.source_info(span); for stmt in stmts { @@ -202,7 +183,7 @@ fn ast_block_stmts( let_scope_stack.push(remainder_scope); let visibility_scope = - Some(this.new_source_scope(remainder_span, LintLevel::Inherited, None)); + Some(this.new_source_scope(remainder_span, LintLevel::Inherited)); let initializer_span = this.thir[*initializer].span; let scope = (*init_scope, source_info); @@ -271,7 +252,7 @@ fn ast_block_stmts( let remainder_span = remainder_scope.span(this.tcx, this.region_scope_tree); let visibility_scope = - Some(this.new_source_scope(remainder_span, LintLevel::Inherited, None)); + Some(this.new_source_scope(remainder_span, LintLevel::Inherited)); // Evaluate the initializer, if present. if let Some(init) = *initializer { @@ -364,22 +345,6 @@ fn ast_block_stmts( } // Restore the original source scope. this.source_scope = outer_source_scope; - this.in_scope_unsafe = outer_in_scope_unsafe; block.unit() } - - /// If we are entering an unsafe block, create a new source scope - fn update_source_scope_for_safety_mode(&mut self, span: Span, safety_mode: BlockSafety) { - debug!("update_source_scope_for({:?}, {:?})", span, safety_mode); - let new_unsafety = match safety_mode { - BlockSafety::Safe => return, - BlockSafety::BuiltinUnsafe => Safety::BuiltinUnsafe, - BlockSafety::ExplicitUnsafe(hir_id) => { - self.in_scope_unsafe = Safety::ExplicitUnsafe(hir_id); - Safety::ExplicitUnsafe(hir_id) - } - }; - - self.source_scope = self.new_source_scope(span, LintLevel::Inherited, Some(new_unsafety)); - } } diff --git a/compiler/rustc_mir_build/src/build/custom/mod.rs b/compiler/rustc_mir_build/src/build/custom/mod.rs index 0475bb8908b..30877e38318 100644 --- a/compiler/rustc_mir_build/src/build/custom/mod.rs +++ b/compiler/rustc_mir_build/src/build/custom/mod.rs @@ -72,10 +72,7 @@ pub(super) fn build_custom_mir<'tcx>( parent_scope: None, inlined: None, inlined_parent_scope: None, - local_data: ClearCrossCrate::Set(SourceScopeLocalData { - lint_root: hir_id, - safety: Safety::Safe, - }), + local_data: ClearCrossCrate::Set(SourceScopeLocalData { lint_root: hir_id }), }); body.injection_phase = Some(parse_attribute(attr)); diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs index c77f4a06d05..00600f354ca 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs @@ -118,19 +118,12 @@ pub(crate) fn as_rvalue( ExprKind::Box { value } => { let value_ty = this.thir[value].ty; let tcx = this.tcx; - - // `exchange_malloc` is unsafe but box is safe, so need a new scope. - let synth_scope = this.new_source_scope( - expr_span, - LintLevel::Inherited, - Some(Safety::BuiltinUnsafe), - ); - let synth_info = SourceInfo { span: expr_span, scope: synth_scope }; + let source_info = this.source_info(expr_span); let size = this.temp(tcx.types.usize, expr_span); this.cfg.push_assign( block, - synth_info, + source_info, size, Rvalue::NullaryOp(NullOp::SizeOf, value_ty), ); @@ -138,7 +131,7 @@ pub(crate) fn as_rvalue( let align = this.temp(tcx.types.usize, expr_span); this.cfg.push_assign( block, - synth_info, + source_info, align, Rvalue::NullaryOp(NullOp::AlignOf, value_ty), ); @@ -154,7 +147,7 @@ pub(crate) fn as_rvalue( let success = this.cfg.start_new_block(); this.cfg.terminate( block, - synth_info, + source_info, TerminatorKind::Call { func: exchange_malloc, args: vec![ diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index b4eeeccc127..c8360b6a5fd 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -69,7 +69,7 @@ pub(crate) fn expr_into_dest( // FIXME: Does this need extra logic to handle let-chains? let source_info = if this.is_let(cond) { let variable_scope = - this.new_source_scope(then_span, LintLevel::Inherited, None); + this.new_source_scope(then_span, LintLevel::Inherited); this.source_scope = variable_scope; SourceInfo { span: then_span, scope: variable_scope } } else { diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index a6b513ce7d0..1ea671a4f79 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -732,7 +732,7 @@ pub(crate) fn declare_bindings( &mut |this, name, mode, var, span, ty, user_ty| { if visibility_scope.is_none() { visibility_scope = - Some(this.new_source_scope(scope_span, LintLevel::Inherited, None)); + Some(this.new_source_scope(scope_span, LintLevel::Inherited)); } let source_info = SourceInfo { span, scope: this.source_scope }; let visibility_scope = visibility_scope.unwrap(); diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 274edf358e0..6972bc00e0b 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -66,17 +66,10 @@ pub(crate) fn mir_build<'tcx>(tcx: TyCtxtAt<'tcx>, def: LocalDefId) -> Body<'tcx // maybe move the check to a MIR pass? tcx.ensure().check_liveness(def); - if tcx.sess.opts.unstable_opts.thir_unsafeck { - // Don't steal here if THIR unsafeck is being used. Instead - // steal in unsafeck. This is so that pattern inline constants - // can be evaluated as part of building the THIR of the parent - // function without a cycle. - build_mir(&thir.borrow()) - } else { - // We ran all queries that depended on THIR at the beginning - // of `mir_build`, so now we can steal it - build_mir(&thir.steal()) - } + // Don't steal here, instead steal in unsafeck. This is so that + // pattern inline constants can be evaluated as part of building the + // THIR of the parent function without a cycle. + build_mir(&thir.borrow()) } }; @@ -190,9 +183,6 @@ struct Builder<'a, 'tcx> { /// `{ STMTS; EXPR1 } + EXPR2`. block_context: BlockContext, - /// The current unsafe block in scope - in_scope_unsafe: Safety, - /// The vector of all scopes that we have created thus far; /// we track this for debuginfo later. source_scopes: IndexVec>, @@ -470,11 +460,6 @@ fn construct_fn<'tcx>( .output .span(); - let safety = match fn_sig.unsafety { - hir::Unsafety::Normal => Safety::Safe, - hir::Unsafety::Unsafe => Safety::FnUnsafe, - }; - let mut abi = fn_sig.abi; if let DefKind::Closure = tcx.def_kind(fn_def) { // HACK(eddyb) Avoid having RustCall on closures, @@ -520,7 +505,6 @@ fn construct_fn<'tcx>( fn_id, span_with_body, arguments.len(), - safety, return_ty, return_ty_span, coroutine, @@ -590,18 +574,8 @@ fn construct_const<'a, 'tcx>( }; let infcx = tcx.infer_ctxt().build(); - let mut builder = Builder::new( - thir, - infcx, - def, - hir_id, - span, - 0, - Safety::Safe, - const_ty, - const_ty_span, - None, - ); + let mut builder = + Builder::new(thir, infcx, def, hir_id, span, 0, const_ty, const_ty_span, None); let mut block = START_BLOCK; unpack!(block = builder.expr_into_dest(Place::return_place(), block, expr)); @@ -723,10 +697,7 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) - parent_scope: None, inlined: None, inlined_parent_scope: None, - local_data: ClearCrossCrate::Set(SourceScopeLocalData { - lint_root: hir_id, - safety: Safety::Safe, - }), + local_data: ClearCrossCrate::Set(SourceScopeLocalData { lint_root: hir_id }), }); cfg.terminate(START_BLOCK, source_info, TerminatorKind::Unreachable); @@ -753,7 +724,6 @@ fn new( hir_id: hir::HirId, span: Span, arg_count: usize, - safety: Safety, return_ty: Ty<'tcx>, return_span: Span, coroutine: Option>>, @@ -795,7 +765,6 @@ fn new( guard_context: vec![], fixed_temps: Default::default(), fixed_temps_scope: None, - in_scope_unsafe: safety, local_decls: IndexVec::from_elem_n(LocalDecl::new(return_ty, return_span), 1), canonical_user_type_annotations: IndexVec::new(), upvars: CaptureMap::new(), @@ -807,10 +776,7 @@ fn new( }; assert_eq!(builder.cfg.start_new_block(), START_BLOCK); - assert_eq!( - builder.new_source_scope(span, lint_level, Some(safety)), - OUTERMOST_SOURCE_SCOPE - ); + assert_eq!(builder.new_source_scope(span, lint_level), OUTERMOST_SOURCE_SCOPE); builder.source_scopes[OUTERMOST_SOURCE_SCOPE].parent_scope = None; builder @@ -1024,7 +990,7 @@ fn set_correct_source_scope_for_arg( .as_ref() .assert_crate_local() .lint_root; - self.maybe_new_source_scope(pattern_span, None, arg_hir_id, parent_id); + self.maybe_new_source_scope(pattern_span, arg_hir_id, parent_id); } fn get_unit_temp(&mut self) -> Place<'tcx> { diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs index aef63896dde..9ac8c1b4417 100644 --- a/compiler/rustc_mir_build/src/build/scope.rs +++ b/compiler/rustc_mir_build/src/build/scope.rs @@ -578,7 +578,7 @@ pub(crate) fn in_scope( if let LintLevel::Explicit(current_hir_id) = lint_level { let parent_id = self.source_scopes[source_scope].local_data.as_ref().assert_crate_local().lint_root; - self.maybe_new_source_scope(region_scope.1.span, None, current_hir_id, parent_id); + self.maybe_new_source_scope(region_scope.1.span, current_hir_id, parent_id); } self.push_scope(region_scope); let mut block; @@ -767,7 +767,6 @@ fn leave_top_scope(&mut self, block: BasicBlock) -> BasicBlock { pub(crate) fn maybe_new_source_scope( &mut self, span: Span, - safety: Option, current_id: HirId, parent_id: HirId, ) { @@ -797,7 +796,7 @@ pub(crate) fn maybe_new_source_scope( if current_root != parent_root { let lint_level = LintLevel::Explicit(current_root); - self.source_scope = self.new_source_scope(span, lint_level, safety); + self.source_scope = self.new_source_scope(span, lint_level); } } @@ -846,18 +845,12 @@ fn maybe_lint_level_root_bounded(&mut self, orig_id: HirId) -> HirId { } /// Creates a new source scope, nested in the current one. - pub(crate) fn new_source_scope( - &mut self, - span: Span, - lint_level: LintLevel, - safety: Option, - ) -> SourceScope { + pub(crate) fn new_source_scope(&mut self, span: Span, lint_level: LintLevel) -> SourceScope { let parent = self.source_scope; debug!( - "new_source_scope({:?}, {:?}, {:?}) - parent({:?})={:?}", + "new_source_scope({:?}, {:?}) - parent({:?})={:?}", span, lint_level, - safety, parent, self.source_scopes.get(parent) ); @@ -867,9 +860,6 @@ pub(crate) fn new_source_scope( } else { self.source_scopes[parent].local_data.as_ref().assert_crate_local().lint_root }, - safety: safety.unwrap_or_else(|| { - self.source_scopes[parent].local_data.as_ref().assert_crate_local().safety - }), }; self.source_scopes.push(SourceScopeData { span, diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 07dc332b791..8aa9a75d96a 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -909,11 +909,6 @@ pub fn emit_requires_unsafe_err( } 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 // Also, don't safety check custom MIR if tcx.is_typeck_child(def.to_def_id()) || tcx.has_attr(def, sym::custom_mir) { diff --git a/compiler/rustc_mir_transform/messages.ftl b/compiler/rustc_mir_transform/messages.ftl index b8dbdf18db3..f9b79d72b05 100644 --- a/compiler/rustc_mir_transform/messages.ftl +++ b/compiler/rustc_mir_transform/messages.ftl @@ -1,6 +1,4 @@ mir_transform_arithmetic_overflow = this arithmetic operation will overflow -mir_transform_call_to_unsafe_label = call to unsafe function -mir_transform_call_to_unsafe_note = consult the function's documentation for information on how to avoid undefined behavior mir_transform_const_defined_here = `const` item defined here mir_transform_const_modify = attempting to modify a `const` item @@ -11,10 +9,6 @@ mir_transform_const_mut_borrow = taking a mutable reference to a `const` item .note2 = the mutable reference will refer to this temporary, not the original `const` item .note3 = mutable reference created due to call to this method -mir_transform_const_ptr2int_label = cast of pointer to int -mir_transform_const_ptr2int_note = casting pointers to integers in constants -mir_transform_deref_ptr_label = dereference of raw pointer -mir_transform_deref_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 mir_transform_ffi_unwind_call = call to {$foreign -> [true] foreign function *[false] function pointer @@ -23,56 +17,13 @@ mir_transform_ffi_unwind_call = call to {$foreign -> mir_transform_fn_item_ref = taking a reference to a function item does not give a function pointer .suggestion = cast `{$ident}` to obtain a function pointer -mir_transform_initializing_valid_range_label = initializing type with `rustc_layout_scalar_valid_range` attr -mir_transform_initializing_valid_range_note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior mir_transform_must_not_suspend = {$pre}`{$def_path}`{$post} held across a suspend point, but should not be .label = the value is held across this suspend point .note = {$reason} .help = consider using a block (`{"{ ... }"}`) to shrink the value's scope, ending before the suspend point - -mir_transform_mutation_layout_constrained_borrow_label = borrow of layout constrained field with interior mutability -mir_transform_mutation_layout_constrained_borrow_note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values -mir_transform_mutation_layout_constrained_label = mutation of layout constrained field -mir_transform_mutation_layout_constrained_note = mutating layout constrained fields cannot statically be checked for valid values mir_transform_operation_will_panic = this operation will panic at runtime -mir_transform_requires_unsafe = {$details} is unsafe and requires unsafe {$op_in_unsafe_fn_allowed -> - [true] function or block - *[false] block - } - .not_inherited = items do not inherit unsafety from separate enclosing items - -mir_transform_target_feature_call_help = in order for the call to be safe, the context requires the following additional target {$missing_target_features_count -> - [1] feature - *[count] features - }: {$missing_target_features} - -mir_transform_target_feature_call_label = call to function with `#[target_feature]` -mir_transform_target_feature_call_note = the {$build_target_features} target {$build_target_features_count -> - [1] feature - *[count] features - } being enabled in the build configuration does not remove the requirement to list {$build_target_features_count -> - [1] it - *[count] them - } in `#[target_feature]` - mir_transform_unaligned_packed_ref = reference to packed field is unaligned .note = packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses .note_ub = 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) - -mir_transform_union_access_label = access to union field -mir_transform_union_access_note = the field may not be properly initialized: using uninitialized data will cause undefined behavior -mir_transform_unsafe_op_in_unsafe_fn = {$details} is unsafe and requires unsafe block (error E0133) - .suggestion = consider wrapping the function body in an unsafe block - .note = an unsafe function restricts its caller, but its body is safe by default - -mir_transform_unused_unsafe = unnecessary `unsafe` block - .label = because it's nested under this `unsafe` block - -mir_transform_use_of_asm_label = use of inline assembly -mir_transform_use_of_asm_note = inline assembly is entirely unchecked and can cause undefined behavior -mir_transform_use_of_extern_static_label = use of extern static -mir_transform_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 -mir_transform_use_of_static_mut_label = use of mutable static -mir_transform_use_of_static_mut_note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs deleted file mode 100644 index a0c3de3af58..00000000000 --- a/compiler/rustc_mir_transform/src/check_unsafety.rs +++ /dev/null @@ -1,615 +0,0 @@ -use rustc_data_structures::unord::{ExtendUnord, UnordItems, UnordSet}; -use rustc_hir as hir; -use rustc_hir::def::DefKind; -use rustc_hir::def_id::{DefId, LocalDefId}; -use rustc_hir::hir_id::HirId; -use rustc_hir::intravisit; -use rustc_hir::{BlockCheckMode, ExprKind, Node}; -use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor}; -use rustc_middle::mir::*; -use rustc_middle::query::Providers; -use rustc_middle::ty::{self, TyCtxt}; -use rustc_session::lint::builtin::{UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE}; -use rustc_session::lint::Level; - -use std::ops::Bound; - -use crate::errors; - -pub struct UnsafetyChecker<'a, 'tcx> { - body: &'a Body<'tcx>, - body_did: LocalDefId, - violations: Vec, - source_info: SourceInfo, - tcx: TyCtxt<'tcx>, - param_env: ty::ParamEnv<'tcx>, - - /// Used `unsafe` blocks in this function. This is used for the "unused_unsafe" lint. - used_unsafe_blocks: UnordSet, -} - -impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { - fn new( - body: &'a Body<'tcx>, - body_did: LocalDefId, - tcx: TyCtxt<'tcx>, - param_env: ty::ParamEnv<'tcx>, - ) -> Self { - Self { - body, - body_did, - violations: vec![], - source_info: SourceInfo::outermost(body.span), - tcx, - param_env, - used_unsafe_blocks: Default::default(), - } - } -} - -impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> { - fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) { - self.source_info = terminator.source_info; - match terminator.kind { - TerminatorKind::Goto { .. } - | TerminatorKind::SwitchInt { .. } - | TerminatorKind::Drop { .. } - | TerminatorKind::Yield { .. } - | TerminatorKind::Assert { .. } - | TerminatorKind::CoroutineDrop - | TerminatorKind::UnwindResume - | TerminatorKind::UnwindTerminate(_) - | TerminatorKind::Return - | TerminatorKind::Unreachable - | TerminatorKind::FalseEdge { .. } - | TerminatorKind::FalseUnwind { .. } => { - // safe (at least as emitted during MIR construction) - } - - TerminatorKind::Call { ref func, .. } => { - let func_ty = func.ty(self.body, self.tcx); - let func_id = - if let ty::FnDef(func_id, _) = func_ty.kind() { Some(func_id) } else { None }; - let sig = func_ty.fn_sig(self.tcx); - if let hir::Unsafety::Unsafe = sig.unsafety() { - self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::CallToUnsafeFunction, - ) - } - - if let Some(func_id) = func_id { - self.check_target_features(*func_id); - } - } - - TerminatorKind::InlineAsm { .. } => self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::UseOfInlineAssembly, - ), - } - self.super_terminator(terminator, location); - } - - fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) { - self.source_info = statement.source_info; - match statement.kind { - StatementKind::Assign(..) - | StatementKind::FakeRead(..) - | StatementKind::SetDiscriminant { .. } - | StatementKind::Deinit(..) - | StatementKind::StorageLive(..) - | StatementKind::StorageDead(..) - | StatementKind::Retag { .. } - | StatementKind::PlaceMention(..) - | StatementKind::Coverage(..) - | StatementKind::Intrinsic(..) - | StatementKind::ConstEvalCounter - | StatementKind::Nop => { - // safe (at least as emitted during MIR construction) - } - // `AscribeUserType` just exists to help MIR borrowck. - // It has no semantics, and everything is already reported by `PlaceMention`. - StatementKind::AscribeUserType(..) => return, - } - self.super_statement(statement, location); - } - - fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) { - match rvalue { - Rvalue::Aggregate(box ref aggregate, _) => match aggregate { - &AggregateKind::Array(..) | &AggregateKind::Tuple => {} - &AggregateKind::Adt(adt_did, ..) => { - match self.tcx.layout_scalar_valid_range(adt_did) { - (Bound::Unbounded, Bound::Unbounded) => {} - _ => self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::InitializingTypeWith, - ), - } - } - &AggregateKind::Closure(def_id, _) - | &AggregateKind::CoroutineClosure(def_id, _) - | &AggregateKind::Coroutine(def_id, _) => { - let def_id = def_id.expect_local(); - let UnsafetyCheckResult { violations, used_unsafe_blocks, .. } = - self.tcx.mir_unsafety_check_result(def_id); - self.register_violations(violations, used_unsafe_blocks.items().copied()); - } - }, - _ => {} - } - self.super_rvalue(rvalue, location); - } - - fn visit_operand(&mut self, op: &Operand<'tcx>, location: Location) { - if let Operand::Constant(constant) = op { - let maybe_uneval = match constant.const_ { - Const::Val(..) | Const::Ty(_) => None, - Const::Unevaluated(uv, _) => Some(uv), - }; - - if let Some(uv) = maybe_uneval { - if uv.promoted.is_none() { - let def_id = uv.def; - 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.mir_unsafety_check_result(local_def_id); - self.register_violations(violations, used_unsafe_blocks.items().copied()); - } - } - } - } - self.super_operand(op, location); - } - - fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location: Location) { - // On types with `scalar_valid_range`, prevent - // * `&mut x.field` - // * `x.field = y;` - // * `&x.field` if `field`'s type has interior mutability - // because either of these would allow modifying the layout constrained field and - // insert values that violate the layout constraints. - if context.is_mutating_use() || context.is_borrow() { - self.check_mut_borrowing_layout_constrained_field(*place, context.is_mutating_use()); - } - - // Some checks below need the extra meta info of the local declaration. - let decl = &self.body.local_decls[place.local]; - - // Check the base local: it might be an unsafe-to-access static. We only check derefs of the - // temporary holding the static pointer to avoid duplicate errors - // . - if place.projection.first() == Some(&ProjectionElem::Deref) { - // If the projection root is an artificial local that we introduced when - // desugaring `static`, give a more specific error message - // (avoid the general "raw pointer" clause below, that would only be confusing). - if let LocalInfo::StaticRef { def_id, .. } = *decl.local_info() { - if self.tcx.is_mutable_static(def_id) { - self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::UseOfMutableStatic, - ); - return; - } else if self.tcx.is_foreign_item(def_id) { - self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::UseOfExternStatic, - ); - return; - } - } - } - - // Check for raw pointer `Deref`. - for (base, proj) in place.iter_projections() { - if proj == ProjectionElem::Deref { - let base_ty = base.ty(self.body, self.tcx).ty; - if base_ty.is_unsafe_ptr() { - self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::DerefOfRawPointer, - ) - } - } - } - - // Check for union fields. For this we traverse right-to-left, as the last `Deref` changes - // whether we *read* the union field or potentially *write* to it (if this place is being assigned to). - let mut saw_deref = false; - for (base, proj) in place.iter_projections().rev() { - if proj == ProjectionElem::Deref { - saw_deref = true; - continue; - } - - let base_ty = base.ty(self.body, self.tcx).ty; - if base_ty.is_union() { - // If we did not hit a `Deref` yet and the overall place use is an assignment, the - // rules are different. - let assign_to_field = !saw_deref - && matches!( - context, - PlaceContext::MutatingUse( - MutatingUseContext::Store - | MutatingUseContext::Drop - | MutatingUseContext::AsmOutput - ) - ); - // If this is just an assignment, determine if the assigned type needs dropping. - if assign_to_field { - // We have to check the actual type of the assignment, as that determines if the - // old value is being dropped. - let assigned_ty = place.ty(&self.body.local_decls, self.tcx).ty; - if assigned_ty.needs_drop(self.tcx, self.param_env) { - // This would be unsafe, but should be outright impossible since we reject - // such unions. - assert!( - self.tcx.dcx().has_errors().is_some(), - "union fields that need dropping should be impossible: {assigned_ty}" - ); - } - } else { - self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::AccessToUnionField, - ) - } - } - } - } -} - -impl<'tcx> UnsafetyChecker<'_, 'tcx> { - fn require_unsafe(&mut self, kind: UnsafetyViolationKind, details: UnsafetyViolationDetails) { - // Violations can turn out to be `UnsafeFn` during analysis, but they should not start out as such. - assert_ne!(kind, UnsafetyViolationKind::UnsafeFn); - - let source_info = self.source_info; - let lint_root = self.body.source_scopes[self.source_info.scope] - .local_data - .as_ref() - .assert_crate_local() - .lint_root; - self.register_violations( - [&UnsafetyViolation { source_info, lint_root, kind, details }], - UnordItems::empty(), - ); - } - - fn register_violations<'a>( - &mut self, - violations: impl IntoIterator, - new_used_unsafe_blocks: UnordItems>, - ) { - let safety = self.body.source_scopes[self.source_info.scope] - .local_data - .as_ref() - .assert_crate_local() - .safety; - match safety { - // `unsafe` blocks are required in safe code - Safety::Safe => violations.into_iter().for_each(|violation| { - match violation.kind { - UnsafetyViolationKind::General => {} - UnsafetyViolationKind::UnsafeFn => { - bug!("`UnsafetyViolationKind::UnsafeFn` in an `Safe` context") - } - } - if !self.violations.contains(violation) { - self.violations.push(violation.clone()) - } - }), - // With the RFC 2585, no longer allow `unsafe` operations in `unsafe fn`s - Safety::FnUnsafe => violations.into_iter().for_each(|violation| { - let mut violation = violation.clone(); - violation.kind = UnsafetyViolationKind::UnsafeFn; - if !self.violations.contains(&violation) { - self.violations.push(violation) - } - }), - Safety::BuiltinUnsafe => {} - Safety::ExplicitUnsafe(hir_id) => violations.into_iter().for_each(|_violation| { - self.used_unsafe_blocks.insert(hir_id); - }), - }; - - self.used_unsafe_blocks.extend_unord(new_used_unsafe_blocks); - } - fn check_mut_borrowing_layout_constrained_field( - &mut self, - place: Place<'tcx>, - is_mut_use: bool, - ) { - for (place_base, elem) in place.iter_projections().rev() { - match elem { - // Modifications behind a dereference don't affect the value of - // the pointer. - ProjectionElem::Deref => return, - ProjectionElem::Field(..) => { - let ty = place_base.ty(&self.body.local_decls, self.tcx).ty; - if let ty::Adt(def, _) = ty.kind() { - if self.tcx.layout_scalar_valid_range(def.did()) - != (Bound::Unbounded, Bound::Unbounded) - { - let details = if is_mut_use { - UnsafetyViolationDetails::MutationOfLayoutConstrainedField - - // Check `is_freeze` as late as possible to avoid cycle errors - // with opaque types. - } else if !place - .ty(self.body, self.tcx) - .ty - .is_freeze(self.tcx, self.param_env) - { - UnsafetyViolationDetails::BorrowOfLayoutConstrainedField - } else { - continue; - }; - self.require_unsafe(UnsafetyViolationKind::General, details); - } - } - } - _ => {} - } - } - } - - /// Checks whether calling `func_did` needs an `unsafe` context or not, i.e. whether - /// the called function has target features the calling function hasn't. - fn check_target_features(&mut self, func_did: DefId) { - // Unsafety isn't required on wasm targets. For more information see - // the corresponding check in typeck/src/collect.rs - if self.tcx.sess.target.options.is_like_wasm { - return; - } - - let callee_features = &self.tcx.codegen_fn_attrs(func_did).target_features; - // The body might be a constant, so it doesn't have codegen attributes. - let self_features = &self.tcx.body_codegen_attrs(self.body_did.to_def_id()).target_features; - - // Is `callee_features` a subset of `calling_features`? - if !callee_features.iter().all(|feature| self_features.contains(feature)) { - let missing: Vec<_> = callee_features - .iter() - .copied() - .filter(|feature| !self_features.contains(feature)) - .collect(); - let build_enabled = self - .tcx - .sess - .target_features - .iter() - .copied() - .filter(|feature| missing.contains(feature)) - .collect(); - self.require_unsafe( - UnsafetyViolationKind::General, - UnsafetyViolationDetails::CallToFunctionWith { missing, build_enabled }, - ) - } - } -} - -pub(crate) fn provide(providers: &mut Providers) { - *providers = Providers { mir_unsafety_check_result, ..*providers }; -} - -/// Context information for [`UnusedUnsafeVisitor`] traversal, -/// saves (innermost) relevant context -#[derive(Copy, Clone, Debug)] -enum Context { - Safe, - /// in an `unsafe fn` - UnsafeFn, - /// in a *used* `unsafe` block - /// (i.e. a block without unused-unsafe warning) - UnsafeBlock(HirId), -} - -struct UnusedUnsafeVisitor<'a, 'tcx> { - tcx: TyCtxt<'tcx>, - used_unsafe_blocks: &'a UnordSet, - context: Context, - unused_unsafes: &'a mut Vec<(HirId, UnusedUnsafe)>, -} - -impl<'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'_, 'tcx> { - fn visit_block(&mut self, block: &'tcx hir::Block<'tcx>) { - if let hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::UserProvided) = block.rules { - let used = match self.tcx.lint_level_at_node(UNUSED_UNSAFE, block.hir_id) { - (Level::Allow, _) => true, - _ => self.used_unsafe_blocks.contains(&block.hir_id), - }; - let unused_unsafe = match (self.context, used) { - (_, false) => UnusedUnsafe::Unused, - (Context::Safe, true) | (Context::UnsafeFn, true) => { - let previous_context = self.context; - self.context = Context::UnsafeBlock(block.hir_id); - intravisit::walk_block(self, block); - self.context = previous_context; - return; - } - (Context::UnsafeBlock(hir_id), true) => UnusedUnsafe::InUnsafeBlock(hir_id), - }; - self.unused_unsafes.push((block.hir_id, unused_unsafe)); - } - intravisit::walk_block(self, block); - } - - fn visit_inline_const(&mut self, c: &'tcx hir::ConstBlock) { - self.visit_body(self.tcx.hir().body(c.body)) - } - - fn visit_fn( - &mut self, - fk: intravisit::FnKind<'tcx>, - _fd: &'tcx hir::FnDecl<'tcx>, - b: hir::BodyId, - _s: rustc_span::Span, - _id: LocalDefId, - ) { - if matches!(fk, intravisit::FnKind::Closure) { - self.visit_body(self.tcx.hir().body(b)) - } - } -} - -fn check_unused_unsafe( - tcx: TyCtxt<'_>, - def_id: LocalDefId, - used_unsafe_blocks: &UnordSet, -) -> Vec<(HirId, UnusedUnsafe)> { - let body_id = tcx.hir().maybe_body_owned_by(def_id); - - let Some(body_id) = body_id else { - debug!("check_unused_unsafe({:?}) - no body found", def_id); - return vec![]; - }; - - let body = tcx.hir().body(body_id); - let hir_id = tcx.local_def_id_to_hir_id(def_id); - let context = match tcx.hir().fn_sig_by_hir_id(hir_id) { - Some(sig) if sig.header.unsafety == hir::Unsafety::Unsafe => Context::UnsafeFn, - _ => Context::Safe, - }; - - debug!( - "check_unused_unsafe({:?}, context={:?}, body={:?}, used_unsafe_blocks={:?})", - def_id, body, context, used_unsafe_blocks - ); - - let mut unused_unsafes = vec![]; - - let mut visitor = UnusedUnsafeVisitor { - tcx, - used_unsafe_blocks, - context, - unused_unsafes: &mut unused_unsafes, - }; - intravisit::Visitor::visit_body(&mut visitor, body); - - unused_unsafes -} - -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 - // `mir_built` force this. - let body = &tcx.mir_built(def).borrow(); - - if body.is_custom_mir() || body.tainted_by_errors.is_some() { - return tcx.arena.alloc(UnsafetyCheckResult { - violations: Vec::new(), - used_unsafe_blocks: Default::default(), - unused_unsafes: Some(Vec::new()), - }); - } - - let param_env = tcx.param_env(def); - - let mut checker = UnsafetyChecker::new(body, def, tcx, param_env); - checker.visit_body(body); - - let unused_unsafes = (!tcx.is_typeck_child(def.to_def_id())) - .then(|| check_unused_unsafe(tcx, def, &checker.used_unsafe_blocks)); - - tcx.arena.alloc(UnsafetyCheckResult { - violations: checker.violations, - used_unsafe_blocks: checker.used_unsafe_blocks, - unused_unsafes, - }) -} - -fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) { - let span = tcx.sess.source_map().guess_head_span(tcx.hir().span(id)); - let nested_parent = if let UnusedUnsafe::InUnsafeBlock(id) = kind { - Some(tcx.sess.source_map().guess_head_span(tcx.hir().span(id))) - } else { - None - }; - tcx.emit_node_span_lint(UNUSED_UNSAFE, id, span, errors::UnusedUnsafe { span, nested_parent }); -} - -pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) { - debug!("check_unsafety({:?})", def_id); - - // closures and inline consts are handled by their parent fn. - if tcx.is_typeck_child(def_id.to_def_id()) { - return; - } - - 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; - - for &UnsafetyViolation { source_info, lint_root, kind, ref details } in violations.iter() { - let details = - errors::RequiresUnsafeDetail { violation: details.clone(), span: source_info.span }; - - match kind { - UnsafetyViolationKind::General => { - let op_in_unsafe_fn_allowed = unsafe_op_in_unsafe_fn_allowed(tcx, lint_root); - let note_non_inherited = tcx.hir().parent_iter(lint_root).find(|(id, node)| { - if let Node::Expr(block) = node - && let ExprKind::Block(block, _) = block.kind - && let BlockCheckMode::UnsafeBlock(_) = block.rules - { - true - } else if let Some(sig) = tcx.hir().fn_sig_by_hir_id(*id) - && sig.header.is_unsafe() - { - true - } else { - false - } - }); - let enclosing = if let Some((id, _)) = note_non_inherited { - Some(tcx.sess.source_map().guess_head_span(tcx.hir().span(id))) - } else { - None - }; - tcx.dcx().emit_err(errors::RequiresUnsafe { - span: source_info.span, - enclosing, - details, - op_in_unsafe_fn_allowed, - }); - } - UnsafetyViolationKind::UnsafeFn => { - tcx.emit_node_span_lint( - UNSAFE_OP_IN_UNSAFE_FN, - lint_root, - source_info.span, - errors::UnsafeOpInUnsafeFn { - details, - suggest_unsafe_block: suggest_unsafe_block.then(|| { - let hir_id = tcx.local_def_id_to_hir_id(def_id); - let fn_sig = tcx - .hir() - .fn_sig_by_hir_id(hir_id) - .expect("this violation only occurs in fn"); - let body = tcx.hir().body_owned_by(def_id); - let body_span = tcx.hir().body(body).value.span; - let start = tcx.sess.source_map().start_point(body_span).shrink_to_hi(); - let end = tcx.sess.source_map().end_point(body_span).shrink_to_lo(); - (start, end, fn_sig.span) - }), - }, - ); - suggest_unsafe_block = false; - } - } - } - - for &(block_id, kind) in unused_unsafes.as_ref().unwrap() { - report_unused_unsafe(tcx, kind, block_id); - } -} - -fn unsafe_op_in_unsafe_fn_allowed(tcx: TyCtxt<'_>, id: HirId) -> bool { - tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, id).0 == Level::Allow -} diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs index 9297bc51fad..0634e321ea3 100644 --- a/compiler/rustc_mir_transform/src/errors.rs +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -1,11 +1,6 @@ -use std::borrow::Cow; - -use rustc_errors::{ - codes::*, Applicability, Diag, DiagArgValue, DiagCtxt, DiagMessage, Diagnostic, - EmissionGuarantee, Level, LintDiagnostic, -}; +use rustc_errors::{codes::*, Diag, DiagMessage, LintDiagnostic}; use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; -use rustc_middle::mir::{AssertKind, UnsafetyViolationDetails}; +use rustc_middle::mir::AssertKind; use rustc_middle::ty::TyCtxt; use rustc_session::lint::{self, Lint}; use rustc_span::def_id::DefId; @@ -42,168 +37,6 @@ pub(crate) struct UnalignedPackedRef { pub span: Span, } -#[derive(LintDiagnostic)] -#[diag(mir_transform_unused_unsafe)] -pub(crate) struct UnusedUnsafe { - #[label(mir_transform_unused_unsafe)] - pub span: Span, - #[label] - pub nested_parent: Option, -} - -pub(crate) struct RequiresUnsafe { - pub span: Span, - pub details: RequiresUnsafeDetail, - pub enclosing: Option, - pub op_in_unsafe_fn_allowed: bool, -} - -// The primary message for this diagnostic should be '{$label} is unsafe and...', -// so we need to eagerly translate the label here, which isn't supported by the derive API -// We could also exhaustively list out the primary messages for all unsafe violations, -// but this would result in a lot of duplication. -impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for RequiresUnsafe { - #[track_caller] - fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> { - let mut diag = Diag::new(dcx, level, fluent::mir_transform_requires_unsafe); - diag.code(E0133); - diag.span(self.span); - diag.span_label(self.span, self.details.label()); - let desc = dcx.eagerly_translate_to_string(self.details.label(), [].into_iter()); - diag.arg("details", desc); - diag.arg("op_in_unsafe_fn_allowed", self.op_in_unsafe_fn_allowed); - self.details.add_subdiagnostics(&mut diag); - if let Some(sp) = self.enclosing { - diag.span_label(sp, fluent::mir_transform_not_inherited); - } - diag - } -} - -#[derive(Clone)] -pub(crate) struct RequiresUnsafeDetail { - pub span: Span, - pub violation: UnsafetyViolationDetails, -} - -impl RequiresUnsafeDetail { - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] - fn add_subdiagnostics(&self, diag: &mut Diag<'_, G>) { - use UnsafetyViolationDetails::*; - match self.violation { - CallToUnsafeFunction => { - diag.note(fluent::mir_transform_call_to_unsafe_note); - } - UseOfInlineAssembly => { - diag.note(fluent::mir_transform_use_of_asm_note); - } - InitializingTypeWith => { - diag.note(fluent::mir_transform_initializing_valid_range_note); - } - CastOfPointerToInt => { - diag.note(fluent::mir_transform_const_ptr2int_note); - } - UseOfMutableStatic => { - diag.note(fluent::mir_transform_use_of_static_mut_note); - } - UseOfExternStatic => { - diag.note(fluent::mir_transform_use_of_extern_static_note); - } - DerefOfRawPointer => { - diag.note(fluent::mir_transform_deref_ptr_note); - } - AccessToUnionField => { - diag.note(fluent::mir_transform_union_access_note); - } - MutationOfLayoutConstrainedField => { - diag.note(fluent::mir_transform_mutation_layout_constrained_note); - } - BorrowOfLayoutConstrainedField => { - diag.note(fluent::mir_transform_mutation_layout_constrained_borrow_note); - } - CallToFunctionWith { ref missing, ref build_enabled } => { - diag.help(fluent::mir_transform_target_feature_call_help); - diag.arg( - "missing_target_features", - DiagArgValue::StrListSepByAnd( - missing.iter().map(|feature| Cow::from(feature.to_string())).collect(), - ), - ); - diag.arg("missing_target_features_count", missing.len()); - if !build_enabled.is_empty() { - diag.note(fluent::mir_transform_target_feature_call_note); - diag.arg( - "build_target_features", - DiagArgValue::StrListSepByAnd( - build_enabled - .iter() - .map(|feature| Cow::from(feature.to_string())) - .collect(), - ), - ); - diag.arg("build_target_features_count", build_enabled.len()); - } - } - } - } - - fn label(&self) -> DiagMessage { - use UnsafetyViolationDetails::*; - match self.violation { - CallToUnsafeFunction => fluent::mir_transform_call_to_unsafe_label, - UseOfInlineAssembly => fluent::mir_transform_use_of_asm_label, - InitializingTypeWith => fluent::mir_transform_initializing_valid_range_label, - CastOfPointerToInt => fluent::mir_transform_const_ptr2int_label, - UseOfMutableStatic => fluent::mir_transform_use_of_static_mut_label, - UseOfExternStatic => fluent::mir_transform_use_of_extern_static_label, - DerefOfRawPointer => fluent::mir_transform_deref_ptr_label, - AccessToUnionField => fluent::mir_transform_union_access_label, - MutationOfLayoutConstrainedField => { - fluent::mir_transform_mutation_layout_constrained_label - } - BorrowOfLayoutConstrainedField => { - fluent::mir_transform_mutation_layout_constrained_borrow_label - } - CallToFunctionWith { .. } => fluent::mir_transform_target_feature_call_label, - } - } -} - -pub(crate) struct UnsafeOpInUnsafeFn { - pub details: RequiresUnsafeDetail, - - /// These spans point to: - /// 1. the start of the function body - /// 2. the end of the function body - /// 3. the function signature - pub suggest_unsafe_block: Option<(Span, Span, Span)>, -} - -impl<'a> LintDiagnostic<'a, ()> for UnsafeOpInUnsafeFn { - #[track_caller] - fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) { - let desc = diag.dcx.eagerly_translate_to_string(self.details.label(), [].into_iter()); - diag.arg("details", desc); - diag.span_label(self.details.span, self.details.label()); - self.details.add_subdiagnostics(diag); - - if let Some((start, end, fn_sig)) = self.suggest_unsafe_block { - diag.span_note(fn_sig, fluent::mir_transform_note); - diag.tool_only_multipart_suggestion( - fluent::mir_transform_suggestion, - vec![(start, " unsafe {".into()), (end, "}".into())], - Applicability::MaybeIncorrect, - ); - } - } - - fn msg(&self) -> DiagMessage { - fluent::mir_transform_unsafe_op_in_unsafe_fn - } -} - pub(crate) struct AssertLint

{ pub span: Span, pub assert_kind: AssertKind

, diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index a684f9bdff1..e477c068229 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -53,7 +53,6 @@ mod add_retag; mod check_const_item_mutation; mod check_packed_ref; -pub mod check_unsafety; mod remove_place_mention; // This pass is public to allow external drivers to perform MIR cleanup mod add_subtyping_projections; @@ -120,7 +119,6 @@ rustc_fluent_macro::fluent_messages! { "../messages.ftl" } pub fn provide(providers: &mut Providers) { - check_unsafety::provide(providers); coverage::query::provide(providers); ffi_unwind_calls::provide(providers); shim::provide(providers); @@ -280,11 +278,6 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs { } fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal> { - // 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().mir_unsafety_check_result(def); - } - let mut body = tcx.build_mir(def); pass_manager::dump_mir_for_phase_change(tcx, &body); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 6204f868385..a76eb6b06aa 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1950,8 +1950,6 @@ pub(crate) fn parse_function_return(slot: &mut FunctionReturn, v: Option<&str>) #[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 = (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/tests/incremental/hashes/function_interfaces.rs b/tests/incremental/hashes/function_interfaces.rs index 4fa2762099c..ab4d578458d 100644 --- a/tests/incremental/hashes/function_interfaces.rs +++ b/tests/incremental/hashes/function_interfaces.rs @@ -104,17 +104,17 @@ pub fn order_of_parameters(p2: i64, p1: i32) {} // Unsafe ---------------------------------------------------------------------- #[cfg(any(cfail1,cfail4))] -pub fn make_unsafe() {} +pub fn make_unsafe() {} #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean( cfg = "cfail2", - except = "opt_hir_owner_nodes, optimized_mir, typeck, fn_sig" + except = "opt_hir_owner_nodes, typeck, fn_sig" )] #[rustc_clean(cfg = "cfail3")] #[rustc_clean( cfg = "cfail5", - except = "opt_hir_owner_nodes, optimized_mir, typeck, fn_sig" + except = "opt_hir_owner_nodes, typeck, fn_sig" )] #[rustc_clean(cfg = "cfail6")] pub unsafe fn make_unsafe() {} diff --git a/tests/incremental/hashes/inherent_impls.rs b/tests/incremental/hashes/inherent_impls.rs index 2b0de1edc0c..caea394977a 100644 --- a/tests/incremental/hashes/inherent_impls.rs +++ b/tests/incremental/hashes/inherent_impls.rs @@ -348,9 +348,9 @@ pub fn change_method_parameter_order(&self, b: i64, a: i64) { } // Make method unsafe ---------------------------------------------------------- #[cfg(any(cfail1,cfail4))] impl Foo { - //------------------------------------------------------------------------------------ + //---------------------------------------------------------------------- //-------------------------- - //------------------------------------------------------------------------------------ + //---------------------------------------------------------------------- //-------------------------- pub fn make_method_unsafe(&self) { } } @@ -361,9 +361,9 @@ pub fn make_method_unsafe(&self) { } #[rustc_clean(cfg="cfail5")] #[rustc_clean(cfg="cfail6")] impl Foo { - #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,fn_sig,typeck,optimized_mir")] + #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,fn_sig,typeck")] #[rustc_clean(cfg="cfail3")] - #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,fn_sig,typeck,optimized_mir")] + #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,fn_sig,typeck")] #[rustc_clean(cfg="cfail6")] pub unsafe fn make_method_unsafe(&self) { } } diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir index 3b7c4b8796e..ef51b07827f 100644 --- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -17,8 +17,6 @@ fn main() -> () { let _3: *mut usize; scope 3 { debug z => _3; - scope 4 { - } } } } diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 3dcddea0353..d1aa9382a2c 100644 --- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -17,8 +17,6 @@ fn main() -> () { let _3: *mut usize; scope 3 { debug z => _3; - scope 4 { - } } } } diff --git a/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir b/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir index 6c3128f8c36..005b3ee3b24 100644 --- a/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir +++ b/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir @@ -3,8 +3,6 @@ fn main() -> () { let mut _0: (); let _1: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.diff b/tests/mir-opt/box_expr.main.ElaborateDrops.diff index 88b12f19e64..ec40fac2894 100644 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.diff +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.diff @@ -15,8 +15,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir index d697ea49231..d2a0fb0cb3c 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir @@ -93,17 +93,13 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> debug __awaitee => (((*(_1.0: &mut {async fn body of b()})) as variant#3).0: {async fn body of a()}); let _17: (); scope 2 { - } - scope 3 { debug result => _17; } } - scope 4 { + scope 3 { debug __awaitee => (((*(_1.0: &mut {async fn body of b()})) as variant#4).0: {async fn body of a()}); let _33: (); - scope 5 { - } - scope 6 { + scope 4 { debug result => _33; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir index 128af9c5602..db758368a13 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir @@ -16,14 +16,10 @@ fn move_out_by_subslice() -> () { scope 1 { debug a => _1; let _12: [std::boxed::Box; 2]; - scope 4 { + scope 2 { debug _y => _12; } } - scope 2 { - } - scope 3 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir index d50a6872a41..84cd557715c 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir @@ -16,14 +16,10 @@ fn move_out_from_end() -> () { scope 1 { debug a => _1; let _12: std::boxed::Box; - scope 4 { + scope 2 { debug _y => _12; } } - scope 2 { - } - scope 3 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff index 3596671f614..bfefd2b8c95 100644 --- a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff +++ b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff @@ -9,8 +9,6 @@ let mut _4: &i32; let _5: *const i32; + let mut _6: &[&i32; 1]; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff index a044cfc62e2..3f4958f60e8 100644 --- a/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff +++ b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff @@ -14,8 +14,6 @@ debug ptr => _3; let _5: bool; scope 3 { - } - scope 4 { debug ret => _5; } } diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff index 20fda589c39..826f4c34277 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff @@ -13,11 +13,9 @@ let mut _9: &[i32; 3]; scope 1 { debug a => _1; + let _5: i32; scope 2 { - let _5: i32; - scope 3 { - debug _b => _5; - } + debug _b => _5; } } diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff index f1b90c28e72..0e2ec65652f 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff @@ -13,11 +13,9 @@ let mut _9: &[i32; 3]; scope 1 { debug a => _1; + let _5: i32; scope 2 { - let _5: i32; - scope 3 { - debug _b => _5; - } + debug _b => _5; } } diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff index 20fda589c39..826f4c34277 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff @@ -13,11 +13,9 @@ let mut _9: &[i32; 3]; scope 1 { debug a => _1; + let _5: i32; scope 2 { - let _5: i32; - scope 3 { - debug _b => _5; - } + debug _b => _5; } } diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff index f1b90c28e72..0e2ec65652f 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff @@ -13,11 +13,9 @@ let mut _9: &[i32; 3]; scope 1 { debug a => _1; + let _5: i32; scope 2 { - let _5: i32; - scope 3 { - debug _b => _5; - } + debug _b => _5; } } diff --git a/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff index 59ee38f5a2b..a408c197fd1 100644 --- a/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff @@ -15,8 +15,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff index 9d87bd809d1..5706a739602 100644 --- a/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff @@ -15,8 +15,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff b/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff index b389080c497..99a6ba7d08a 100644 --- a/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff +++ b/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff @@ -11,8 +11,6 @@ debug v => _1; let _4: bool; scope 2 { - } - scope 3 { debug y => _4; } } diff --git a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff index da5bf1cf42c..f5041365604 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff @@ -12,23 +12,17 @@ scope 1 { debug _invalid_char => _1; let _3: [E; 1]; - scope 3 { + scope 2 { debug _invalid_tag => _3; let _6: [Empty; 1]; - scope 5 { + scope 3 { debug _enum_without_variants => const [ZeroSized: Empty]; let _9: main::Str<"���">; - scope 7 { + scope 4 { debug _non_utf8_str => const Str::<"���">; } } - scope 6 { - } } - scope 4 { - } - } - scope 2 { } bb0: { diff --git a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff index 455c2375eff..6e5ad8d6b81 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff @@ -12,25 +12,19 @@ scope 1 { debug _invalid_char => _1; let _3: [E; 1]; - scope 3 { + scope 2 { debug _invalid_tag => _3; let _6: [Empty; 1]; - scope 5 { + scope 3 { - debug _enum_without_variants => _6; + debug _enum_without_variants => const [ZeroSized: Empty]; let _9: main::Str<"���">; - scope 7 { + scope 4 { - debug _non_utf8_str => _9; + debug _non_utf8_str => const Str::<"���">; } } - scope 6 { - } } - scope 4 { - } - } - scope 2 { } bb0: { diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff index e113f43a56e..31c839f6749 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff @@ -11,8 +11,6 @@ debug x => _1; let _5: u32; scope 2 { - } - scope 3 { debug y => _5; } } diff --git a/tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff index 47dfb421ebc..2b38e88ae4c 100644 --- a/tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff @@ -3,8 +3,6 @@ fn from_char() -> i32 { let mut _0: i32; - scope 1 { - } bb0: { - _0 = const 'R' as i32 (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff index 47dfb421ebc..2b38e88ae4c 100644 --- a/tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff @@ -3,8 +3,6 @@ fn from_char() -> i32 { let mut _0: i32; - scope 1 { - } bb0: { - _0 = const 'R' as i32 (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff index f0c6f55f775..45c48e9046e 100644 --- a/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff @@ -3,8 +3,6 @@ fn invalid_bool() -> bool { let mut _0: bool; - scope 1 { - } bb0: { - _0 = const -1_i8 as bool (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff index f0c6f55f775..45c48e9046e 100644 --- a/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff @@ -3,8 +3,6 @@ fn invalid_bool() -> bool { let mut _0: bool; - scope 1 { - } bb0: { - _0 = const -1_i8 as bool (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff index 03a7706401f..b4fe64d0aff 100644 --- a/tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff @@ -3,8 +3,6 @@ fn invalid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const core::num::::MAX as char (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff index 03a7706401f..b4fe64d0aff 100644 --- a/tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff @@ -3,8 +3,6 @@ fn invalid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const core::num::::MAX as char (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.32bit.diff index 5e0c076b981..ab3481a3be5 100644 --- a/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.32bit.diff @@ -4,8 +4,6 @@ fn less_as_i8() -> i8 { let mut _0: i8; let mut _1: std::cmp::Ordering; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.64bit.diff index 5e0c076b981..ab3481a3be5 100644 --- a/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.64bit.diff @@ -4,8 +4,6 @@ fn less_as_i8() -> i8 { let mut _0: i8; let mut _1: std::cmp::Ordering; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff index c6a428019d8..febb6bfb0a4 100644 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff @@ -5,8 +5,6 @@ let mut _0: u32; let mut _1: undef_union_as_integer::Union32; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff index c6a428019d8..febb6bfb0a4 100644 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff @@ -5,8 +5,6 @@ let mut _0: u32; let mut _1: undef_union_as_integer::Union32; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff index 2ef83abfac0..7a289563c50 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff index 2ef83abfac0..7a289563c50 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff index b2e91014625..3364782022d 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff index b2e91014625..3364782022d 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff index 0ff31b1a981..a7020793237 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff index 0ff31b1a981..a7020793237 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff index 430d16c97a6..d44b0872035 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff @@ -7,8 +7,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff index 430d16c97a6..d44b0872035 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff @@ -7,8 +7,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff index f9d002f96ab..069ff906ec5 100644 --- a/tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff @@ -3,8 +3,6 @@ fn valid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const 82_u32 as char (Transmute); diff --git a/tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff index f9d002f96ab..069ff906ec5 100644 --- a/tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff @@ -3,8 +3,6 @@ fn valid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const 82_u32 as char (Transmute); diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff index ffb0c4b23fb..ef30ac2fc8c 100644 --- a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff @@ -14,13 +14,11 @@ scope 2 { debug b => _3; let _5: *mut u8; - scope 4 { + scope 3 { - debug c => _5; + debug c => _2; } } - scope 3 { - } } bb0: { diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff index 66a0f49cfb9..a743a3e829a 100644 --- a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff @@ -14,13 +14,11 @@ scope 2 { debug b => _3; let _5: *mut u8; - scope 4 { + scope 3 { - debug c => _5; + debug c => _2; } } - scope 3 { - } } bb0: { diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff index 0777a913523..2de6f85ce64 100644 --- a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff @@ -13,13 +13,11 @@ scope 2 { debug b => _3; let _4: *mut u8; - scope 4 { + scope 3 { - debug c => _4; + debug c => _2; } } - scope 3 { - } } bb0: { diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff index f5a512b8995..2afec4898bc 100644 --- a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff @@ -13,13 +13,11 @@ scope 2 { debug b => _3; let _4: *mut u8; - scope 4 { + scope 3 { - debug c => _4; + debug c => _2; } } - scope 3 { - } } bb0: { diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff index 21cf745b680..44e73b56098 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff index ee58a974480..6cef8b692ba 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff index 9fc9c8ed409..6efccded993 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff index 30d93347afd..a705d0064cb 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index 3a46edbc849..f9c854ca3f4 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index 3c71214c35f..333726689d7 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index 4557e7b26d6..e1841760077 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index 5ab2d5e0fdc..7aa02556ec5 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -17,33 +17,27 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { + let _6: *mut [bool; 0]; scope 6 { - let _6: *mut [bool; 0]; - scope 7 { + debug ptr => _6; + scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: bool; - let _9: (); - let mut _10: *mut (); - let mut _11: *const [bool; 0]; - scope 13 { - scope 14 (inlined core::ub_checks::check_language_ub) { - scope 15 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; + scope 11 (inlined core::ub_checks::check_language_ub) { + scope 12 (inlined core::ub_checks::check_language_ub::runtime) { } } } - scope 8 (inlined dangling_mut::<[bool; 0]>) { - let mut _7: usize; - scope 9 (inlined align_of::<[bool; 0]>) { - } - scope 10 (inlined without_provenance_mut::<[bool; 0]>) { - debug addr => _7; - scope 11 { - } - } + } + scope 7 (inlined dangling_mut::<[bool; 0]>) { + let mut _7: usize; + scope 8 (inlined align_of::<[bool; 0]>) { + } + scope 9 (inlined without_provenance_mut::<[bool; 0]>) { + debug addr => _7; } } } diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff index 9b0093c454e..a5e40990751 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff @@ -9,14 +9,12 @@ let mut _5: *mut u8; scope 1 { debug x => _1; + let _3: *mut u8; let _6: u8; scope 2 { - let _3: *mut u8; - scope 3 { - debug p => _3; - } + debug p => _3; } - scope 4 { + scope 3 { debug x1 => _6; } } diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff index 635a214251b..ce2178ddbee 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff @@ -9,14 +9,12 @@ let mut _5: *mut u8; scope 1 { debug x => _1; + let _3: *mut u8; let _6: u8; scope 2 { - let _3: *mut u8; - scope 3 { - debug p => _3; - } + debug p => _3; } - scope 4 { + scope 3 { debug x1 => _6; } } diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff index 52f096ac0e4..a5529253762 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff @@ -3,8 +3,6 @@ fn from_char() -> i32 { let mut _0: i32; - scope 1 { - } bb0: { - _0 = const 'R' as i32 (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff index 52f096ac0e4..a5529253762 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff @@ -3,8 +3,6 @@ fn from_char() -> i32 { let mut _0: i32; - scope 1 { - } bb0: { - _0 = const 'R' as i32 (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff index 3972eb209a1..a66d8dbe844 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff @@ -3,8 +3,6 @@ fn invalid_bool() -> bool { let mut _0: bool; - scope 1 { - } bb0: { - _0 = const -1_i8 as bool (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff index 3972eb209a1..a66d8dbe844 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff @@ -3,8 +3,6 @@ fn invalid_bool() -> bool { let mut _0: bool; - scope 1 { - } bb0: { - _0 = const -1_i8 as bool (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff index dd737017ffd..4f3f3e03d75 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff @@ -3,8 +3,6 @@ fn invalid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const core::num::::MAX as char (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff index dd737017ffd..4f3f3e03d75 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff @@ -3,8 +3,6 @@ fn invalid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const core::num::::MAX as char (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff index 6091e169e8e..44dd4017409 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff @@ -4,8 +4,6 @@ fn less_as_i8() -> i8 { let mut _0: i8; let mut _1: std::cmp::Ordering; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff index 6091e169e8e..44dd4017409 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff @@ -4,8 +4,6 @@ fn less_as_i8() -> i8 { let mut _0: i8; let mut _1: std::cmp::Ordering; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff index fb28aa8f6d9..14a34a1ce38 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff @@ -5,8 +5,6 @@ let mut _0: u32; let mut _1: undef_union_as_integer::Union32; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff index fb28aa8f6d9..14a34a1ce38 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff @@ -5,8 +5,6 @@ let mut _0: u32; let mut _1: undef_union_as_integer::Union32; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff index 5d17c47ae66..258e2b454eb 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff index 5d17c47ae66..258e2b454eb 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff index c8d4d6edba1..a0b4fb2f5e4 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff index c8d4d6edba1..a0b4fb2f5e4 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff index 2ffaeea72db..ef461423c32 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff index 2ffaeea72db..ef461423c32 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff @@ -8,8 +8,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff index 31fcaafc5bc..c8910029a03 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff @@ -7,8 +7,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff index 31fcaafc5bc..c8910029a03 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff @@ -7,8 +7,6 @@ scope 1 { debug x => _1; } - scope 2 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff index 402ef754a64..580c5044bb8 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff @@ -3,8 +3,6 @@ fn valid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const 82_u32 as char (Transmute); diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff index 402ef754a64..580c5044bb8 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff @@ -3,8 +3,6 @@ fn valid_char() -> char { let mut _0: char; - scope 1 { - } bb0: { - _0 = const 82_u32 as char (Transmute); diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff index 0af3faf28f0..570ec129f06 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff @@ -8,13 +8,11 @@ let mut _3: u32; scope 1 { debug un => _1; - scope 2 { - } - scope 4 (inlined std::mem::drop::) { + scope 3 (inlined std::mem::drop::) { debug _x => _3; } } - scope 3 (inlined val) { + scope 2 (inlined val) { } bb0: { diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff index 0af3faf28f0..570ec129f06 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff @@ -8,13 +8,11 @@ let mut _3: u32; scope 1 { debug un => _1; - scope 2 { - } - scope 4 (inlined std::mem::drop::) { + scope 3 (inlined std::mem::drop::) { debug _x => _3; } } - scope 3 (inlined val) { + scope 2 (inlined val) { } bb0: { diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff index 46bf13985da..906835530d8 100644 --- a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff @@ -37,17 +37,9 @@ debug z => _8; let _13: *mut u32; scope 2 { - } - scope 3 { - } - scope 4 { debug z => _13; let _18: &u32; - scope 5 { - } - scope 6 { - } - scope 7 { + scope 3 { debug z => _18; } } diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff index 3e731ead859..006b5da646c 100644 --- a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff @@ -37,17 +37,9 @@ debug z => _8; let _13: *mut u32; scope 2 { - } - scope 3 { - } - scope 4 { debug z => _13; let _18: &u32; - scope 5 { - } - scope 6 { - } - scope 7 { + scope 3 { debug z => _18; } } diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index f3f9073909e..2389d98b5b3 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -69,17 +69,15 @@ debug u => _29; let _41: &*const u8; let _42: &*const u8; - scope 7 { + scope 6 { debug left_val => _41; debug right_val => _42; let _47: core::panicking::AssertKind; - scope 8 { + scope 7 { debug kind => _47; } } } - scope 6 { - } } } diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index 383152cce5e..50715d748e7 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -69,17 +69,15 @@ debug u => _29; let _41: &*const u8; let _42: &*const u8; - scope 7 { + scope 6 { debug left_val => _41; debug right_val => _42; let _47: core::panicking::AssertKind; - scope 8 { + scope 7 { debug kind => _47; } } } - scope 6 { - } } } diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff index 3ecd4650d81..ba9e507560d 100644 --- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff @@ -175,18 +175,16 @@ let _135: &mut u64; scope 2 { debug b => _135; + let _145: *const u64; let _163: &u64; scope 3 { - let _145: *const u64; + debug c => _145; + let _154: *mut u64; scope 4 { - debug c => _145; - let _154: *mut u64; - scope 5 { - debug d => _154; - } + debug d => _154; } } - scope 6 { + scope 5 { debug e => _163; } } diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff index bf448280b1e..41c01536130 100644 --- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff @@ -175,18 +175,16 @@ let _135: &mut u64; scope 2 { debug b => _135; + let _145: *const u64; let _163: &u64; scope 3 { - let _145: *const u64; + debug c => _145; + let _154: *mut u64; scope 4 { - debug c => _145; - let _154: *mut u64; - scope 5 { - debug d => _154; - } + debug d => _154; } } - scope 6 { + scope 5 { debug e => _163; } } diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff index 11cd43fc0e0..07c4c7663c1 100644 --- a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff @@ -33,13 +33,9 @@ scope 1 { debug a => _1; let _3: *const [u8]; - scope 3 { + scope 2 { debug b => _3; } - scope 4 { - } - } - scope 2 { } bb0: { diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff index c77cd07c60c..df0f93f1077 100644 --- a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff @@ -33,13 +33,9 @@ scope 1 { debug a => _1; let _3: *const [u8]; - scope 3 { + scope 2 { debug b => _3; } - scope 4 { - } - } - scope 2 { } bb0: { diff --git a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff index 86e6aae1191..c5ee0d9c44d 100644 --- a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff @@ -7,12 +7,10 @@ let mut _2: E; let mut _3: &U; let _4: U; + let mut _5: &U; scope 1 { debug i => _1; } - scope 2 { - let mut _5: &U; - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff index 86e6aae1191..c5ee0d9c44d 100644 --- a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff @@ -7,12 +7,10 @@ let mut _2: E; let mut _3: &U; let _4: U; + let mut _5: &U; scope 1 { debug i => _1; } - scope 2 { - let mut _5: &U; - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff index ea9c360aa7b..dc0004105a7 100644 --- a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff @@ -8,8 +8,6 @@ + let _2: D; + scope 2 { + debug _d => const D; -+ scope 3 { -+ } + } + } diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff index a38b8246bde..859082c3111 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff @@ -15,13 +15,11 @@ + } + scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) { + debug pointer => _3; -+ scope 4 { -+ scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) { -+ debug pointer => _3; -+ } ++ scope 4 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) { ++ debug pointer => _3; + } + } -+ scope 6 (inlined g::{closure#0}) { ++ scope 5 (inlined g::{closure#0}) { + debug a => _5; + let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; + let mut _7: u32; diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff index dc6628ab44c..44b06c34972 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff @@ -15,13 +15,11 @@ + } + scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) { + debug pointer => _3; -+ scope 4 { -+ scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) { -+ debug pointer => _3; -+ } ++ scope 4 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) { ++ debug pointer => _3; + } + } -+ scope 6 (inlined g::{closure#0}) { ++ scope 5 (inlined g::{closure#0}) { + debug a => _5; + let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; + let mut _7: u32; diff --git a/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff b/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff index e38daba27fc..158cc973779 100644 --- a/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff +++ b/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff @@ -10,8 +10,6 @@ + scope 1 (inlined instruction_set_default) { + } + scope 2 (inlined inline_always_and_using_inline_asm) { -+ scope 3 { -+ } + } bb0: { diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff index 4fcd49994f0..2a36ccaab11 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -8,18 +8,14 @@ let _3: (); let mut _4: *mut std::vec::Vec; let mut _5: *mut std::option::Option; - scope 1 { -+ scope 3 (inlined std::ptr::drop_in_place::> - shim(Some(Vec))) { -+ let mut _6: &mut std::vec::Vec; -+ let mut _7: (); -+ } - } - scope 2 { -+ scope 4 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { -+ let mut _8: isize; -+ let mut _9: isize; -+ } - } ++ scope 1 (inlined std::ptr::drop_in_place::> - shim(Some(Vec))) { ++ let mut _6: &mut std::vec::Vec; ++ let mut _7: (); ++ } ++ scope 2 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { ++ let mut _8: isize; ++ let mut _9: isize; ++ } bb0: { StorageLive(_3); diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff index 4270ae00b66..e11561076e6 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff @@ -8,14 +8,10 @@ let _3: (); let mut _4: *mut std::vec::Vec; let mut _5: *mut std::option::Option; - scope 1 { - } - scope 2 { -+ scope 3 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { -+ let mut _6: isize; -+ let mut _7: isize; -+ } - } ++ scope 1 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { ++ let mut _6: isize; ++ let mut _7: isize; ++ } bb0: { StorageLive(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff index 51e506142a9..cc1b8b9b70f 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff @@ -10,8 +10,6 @@ + scope 1 (inlined core::num::::unchecked_shl) { + debug self => _3; + debug rhs => _4; -+ scope 2 { -+ } + } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff index 053ccc077a4..f244f378bce 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff @@ -10,8 +10,6 @@ + scope 1 (inlined core::num::::unchecked_shl) { + debug self => _3; + debug rhs => _4; -+ scope 2 { -+ } + } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir index 2be887e9b5a..c96983c18cb 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir @@ -7,8 +7,6 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::::unchecked_shl) { debug self => _1; debug rhs => _2; - scope 2 { - } } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir index 2be887e9b5a..c96983c18cb 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir @@ -7,8 +7,6 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::::unchecked_shl) { debug self => _1; debug rhs => _2; - scope 2 { - } } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff index 816d03b4405..74518db370f 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff @@ -10,8 +10,6 @@ + scope 1 (inlined core::num::::unchecked_shr) { + debug self => _3; + debug rhs => _4; -+ scope 2 { -+ } + } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff index d4121f89baf..aab04624f6c 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff @@ -10,8 +10,6 @@ + scope 1 (inlined core::num::::unchecked_shr) { + debug self => _3; + debug rhs => _4; -+ scope 2 { -+ } + } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir index 4696112175e..1dd8cb27314 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir @@ -7,8 +7,6 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { scope 1 (inlined core::num::::unchecked_shr) { debug self => _1; debug rhs => _2; - scope 2 { - } } bb0: { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir index 4696112175e..1dd8cb27314 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir @@ -7,8 +7,6 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { scope 1 (inlined core::num::::unchecked_shr) { debug self => _1; debug rhs => _2; - scope 2 { - } } bb0: { diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff index 028040edc85..814eda10459 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff @@ -11,15 +11,11 @@ + scope 2 { + debug val => _0; + } -+ scope 3 { -+ scope 4 (inlined unreachable_unchecked) { -+ let mut _4: bool; -+ let _5: (); -+ scope 5 { -+ } -+ scope 6 (inlined core::ub_checks::check_language_ub) { -+ scope 7 (inlined core::ub_checks::check_language_ub::runtime) { -+ } ++ scope 3 (inlined unreachable_unchecked) { ++ let mut _4: bool; ++ let _5: (); ++ scope 4 (inlined core::ub_checks::check_language_ub) { ++ scope 5 (inlined core::ub_checks::check_language_ub::runtime) { + } + } + } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff index 484fd37248c..d5d69074382 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff @@ -11,15 +11,11 @@ + scope 2 { + debug val => _0; + } -+ scope 3 { -+ scope 4 (inlined unreachable_unchecked) { -+ let mut _4: bool; -+ let _5: (); -+ scope 5 { -+ } -+ scope 6 (inlined core::ub_checks::check_language_ub) { -+ scope 7 (inlined core::ub_checks::check_language_ub::runtime) { -+ } ++ scope 3 (inlined unreachable_unchecked) { ++ let mut _4: bool; ++ let _5: (); ++ scope 4 (inlined core::ub_checks::check_language_ub) { ++ scope 5 (inlined core::ub_checks::check_language_ub::runtime) { + } + } + } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir index d629336d385..7c24a97166c 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir @@ -9,13 +9,9 @@ fn unwrap_unchecked(_1: Option) -> T { scope 2 { debug val => _0; } - scope 3 { - scope 4 (inlined unreachable_unchecked) { - scope 5 { - } - scope 6 (inlined core::ub_checks::check_language_ub) { - scope 7 (inlined core::ub_checks::check_language_ub::runtime) { - } + scope 3 (inlined unreachable_unchecked) { + scope 4 (inlined core::ub_checks::check_language_ub) { + scope 5 (inlined core::ub_checks::check_language_ub::runtime) { } } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir index d629336d385..7c24a97166c 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir @@ -9,13 +9,9 @@ fn unwrap_unchecked(_1: Option) -> T { scope 2 { debug val => _0; } - scope 3 { - scope 4 (inlined unreachable_unchecked) { - scope 5 { - } - scope 6 (inlined core::ub_checks::check_language_ub) { - scope 7 (inlined core::ub_checks::check_language_ub::runtime) { - } + scope 3 (inlined unreachable_unchecked) { + scope 4 (inlined core::ub_checks::check_language_ub) { + scope 5 (inlined core::ub_checks::check_language_ub::runtime) { } } } diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff index 0243e31cb1a..f8cceacd7e6 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff @@ -18,9 +18,9 @@ let _4: std::pin::Pin<&mut {async fn body of ActionPermit<'_, T>::perform()}>; scope 2 { debug fut => _4; - scope 4 { + scope 3 { } -+ scope 7 (inlined ActionPermit::<'_, T>::perform::{closure#0}) { ++ scope 6 (inlined ActionPermit::<'_, T>::perform::{closure#0}) { + debug _task_context => _31; + debug self => ((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})).0: ActionPermit<'_, T>); + let _11: ActionPermit<'_, T>; @@ -51,32 +51,28 @@ + let mut _38: &mut {async fn body of ActionPermit<'_, T>::perform()}; + let mut _39: &mut {async fn body of ActionPermit<'_, T>::perform()}; + let mut _40: &mut {async fn body of ActionPermit<'_, T>::perform()}; -+ scope 8 { ++ scope 7 { + debug self => (((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})) as variant#3).0: ActionPermit<'_, T>); + let mut _15: std::future::Ready<()>; -+ scope 9 { ++ scope 8 { + debug __awaitee => (((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})) as variant#3).1: std::future::Ready<()>); + let _26: (); -+ scope 10 { -+ } -+ scope 11 { ++ scope 9 { + debug result => _26; + } + } -+ scope 12 (inlined ready::<()>) { ++ scope 10 (inlined ready::<()>) { + debug t => _14; + let mut _41: std::option::Option<()>; + } + } + } } - scope 3 { -+ scope 6 (inlined Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}>::new_unchecked) { -+ debug pointer => _5; -+ } - } ++ scope 5 (inlined Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}>::new_unchecked) { ++ debug pointer => _5; ++ } } -+ scope 5 (inlined ActionPermit::<'_, T>::perform) { ++ scope 4 (inlined ActionPermit::<'_, T>::perform) { + debug self => _3; + } diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff index 96a93cdda3d..fd080d22d3a 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff @@ -18,9 +18,9 @@ let _4: std::pin::Pin<&mut {async fn body of ActionPermit<'_, T>::perform()}>; scope 2 { debug fut => _4; - scope 4 { + scope 3 { } -+ scope 7 (inlined ActionPermit::<'_, T>::perform::{closure#0}) { ++ scope 6 (inlined ActionPermit::<'_, T>::perform::{closure#0}) { + debug _task_context => _31; + debug self => ((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})).0: ActionPermit<'_, T>); + let _11: ActionPermit<'_, T>; @@ -53,32 +53,28 @@ + let mut _40: &mut {async fn body of ActionPermit<'_, T>::perform()}; + let mut _41: &mut {async fn body of ActionPermit<'_, T>::perform()}; + let mut _42: &mut {async fn body of ActionPermit<'_, T>::perform()}; -+ scope 8 { ++ scope 7 { + debug self => (((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})) as variant#3).0: ActionPermit<'_, T>); + let mut _15: std::future::Ready<()>; -+ scope 9 { ++ scope 8 { + debug __awaitee => (((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})) as variant#3).1: std::future::Ready<()>); + let _26: (); -+ scope 10 { -+ } -+ scope 11 { ++ scope 9 { + debug result => _26; + } + } -+ scope 12 (inlined ready::<()>) { ++ scope 10 (inlined ready::<()>) { + debug t => _14; + let mut _43: std::option::Option<()>; + } + } + } } - scope 3 { -+ scope 6 (inlined Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}>::new_unchecked) { -+ debug pointer => _5; -+ } - } ++ scope 5 (inlined Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}>::new_unchecked) { ++ debug pointer => _5; ++ } } -+ scope 5 (inlined ActionPermit::<'_, T>::perform) { ++ scope 4 (inlined ActionPermit::<'_, T>::perform) { + debug self => _3; + } diff --git a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff index f3402fde05b..6d6c9c9a7a1 100644 --- a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff @@ -5,23 +5,17 @@ debug x => _1; let mut _0: i32; let mut _2: std::option::Option; - scope 1 { - scope 2 (inlined #[track_caller] Option::::unwrap_unchecked) { - debug self => _2; - let mut _3: isize; - scope 3 { - debug val => _0; - } - scope 4 { - scope 5 (inlined unreachable_unchecked) { - let mut _4: bool; - let _5: (); - scope 6 { - } - scope 7 (inlined core::ub_checks::check_language_ub) { - scope 8 (inlined core::ub_checks::check_language_ub::runtime) { - } - } + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { + debug self => _2; + let mut _3: isize; + scope 2 { + debug val => _0; + } + scope 3 (inlined unreachable_unchecked) { + let mut _4: bool; + let _5: (); + scope 4 (inlined core::ub_checks::check_language_ub) { + scope 5 (inlined core::ub_checks::check_language_ub::runtime) { } } } diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir index b4f21240939..53912adc003 100644 --- a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir @@ -4,8 +4,6 @@ fn main() -> () { let mut _0: (); let mut _1: !; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir index 1851747f0a6..50416300094 100644 --- a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir @@ -4,8 +4,6 @@ fn main() -> () { let mut _0: (); let mut _1: !; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir index 91dee82fde0..3104baa5fdb 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir @@ -15,15 +15,13 @@ fn test() -> Option> { let mut _11: std::option::Option; let _12: u32; scope 1 { - } - scope 2 { debug residual => _9; - scope 3 { + scope 2 { } } - scope 4 { + scope 3 { debug val => _12; - scope 5 { + scope 4 { } } diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir index ff7fc74ff61..da33c830115 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir @@ -15,15 +15,13 @@ fn test() -> Option> { let mut _11: std::option::Option; let _12: u32; scope 1 { - } - scope 2 { debug residual => _9; - scope 3 { + scope 2 { } } - scope 4 { + scope 3 { debug val => _12; - scope 5 { + scope 4 { } } diff --git a/tests/mir-opt/issue_72181.main.built.after.mir b/tests/mir-opt/issue_72181.main.built.after.mir index cff20702bf7..fa101512d72 100644 --- a/tests/mir-opt/issue_72181.main.built.after.mir +++ b/tests/mir-opt/issue_72181.main.built.after.mir @@ -15,8 +15,6 @@ fn main() -> () { debug f => _2; scope 3 { } - scope 4 { - } } } diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir index d35aada95f8..ae0dc9a0b6a 100644 --- a/tests/mir-opt/issue_72181_1.main.built.after.mir +++ b/tests/mir-opt/issue_72181_1.main.built.after.mir @@ -14,8 +14,6 @@ fn main() -> () { scope 1 { debug v => _2; } - scope 2 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index f11c993340f..25ed1b4d0c7 100644 --- a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,15 +10,11 @@ let mut _6: u32; scope 1 { debug dwords => _2; - scope 3 { + scope 2 { debug ip => _4; let _4: u32; - scope 4 { - } } } - scope 2 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff index 80a42263643..e9d4352014f 100644 --- a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff @@ -12,8 +12,6 @@ let _2: *mut i32; scope 2 { debug a => _2; - scope 3 { - } } } diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff index 80a42263643..e9d4352014f 100644 --- a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff @@ -12,8 +12,6 @@ let _2: *mut i32; scope 2 { debug a => _2; - scope 3 { - } } } diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff index f9f73bf991d..633a344a2ed 100644 --- a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff @@ -14,8 +14,6 @@ let _5: *const [u8]; scope 2 { debug arr => _5; - scope 3 { - } } } diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff index f9f73bf991d..633a344a2ed 100644 --- a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff @@ -14,8 +14,6 @@ let _5: *const [u8]; scope 2 { debug arr => _5; - scope 3 { - } } } diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff index 79635f23e8e..6c1f457cb5f 100644 --- a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff @@ -4,8 +4,6 @@ fn assume() -> () { let mut _0: (); let _1: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff index 79635f23e8e..6c1f457cb5f 100644 --- a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff @@ -4,8 +4,6 @@ fn assume() -> () { let mut _0: (); let _1: (); - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff index 6de5f2c4f07..96b66af66a2 100644 --- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff @@ -18,8 +18,6 @@ let mut _2: (); scope 2 { debug dst => _2; - scope 3 { - } } } diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff index 6de5f2c4f07..96b66af66a2 100644 --- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff @@ -18,8 +18,6 @@ let mut _2: (); scope 2 { debug dst => _2; - scope 3 { - } } } diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff index 147c48a3c01..781104be290 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff @@ -5,8 +5,6 @@ debug r => _1; let mut _0: i32; let mut _2: *const i32; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff index 147c48a3c01..781104be290 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff @@ -5,8 +5,6 @@ debug r => _1; let mut _0: i32; let mut _2: *const i32; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff index b2cf3cc1cca..56c357b3776 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff @@ -5,8 +5,6 @@ debug r => _1; let mut _0: Never; let mut _2: *const Never; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff index b2cf3cc1cca..56c357b3776 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -5,8 +5,6 @@ debug r => _1; let mut _0: Never; let mut _2: *const Never; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff index 3b4051e4ae2..6e542c4b5a7 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff @@ -5,8 +5,6 @@ debug c => _1; let mut _0: i8; let mut _2: std::cmp::Ordering; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff index 3b4051e4ae2..6e542c4b5a7 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff @@ -5,8 +5,6 @@ debug c => _1; let mut _0: i8; let mut _2: std::cmp::Ordering; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff index 91276a1b5c4..ab4646370f1 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff @@ -5,8 +5,6 @@ debug u => _1; let mut _0: *const T; let mut _2: &T; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff index 91276a1b5c4..ab4646370f1 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff @@ -5,8 +5,6 @@ debug u => _1; let mut _0: *const T; let mut _2: &T; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff index 792c77d575b..6d3ad348988 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff @@ -5,8 +5,6 @@ debug u => _1; let mut _0: Never; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff index 792c77d575b..6d3ad348988 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -5,8 +5,6 @@ debug u => _1; let mut _0: Never; let mut _2: (); - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff index f5646e7f1e9..2b715ac1d63 100644 --- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff @@ -5,8 +5,6 @@ let mut _0: !; let _1: (); let mut _2: !; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff index f5646e7f1e9..2b715ac1d63 100644 --- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff @@ -5,8 +5,6 @@ let mut _0: !; let _1: (); let mut _2: !; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff index ddc8cf9a3d9..cc9177c9002 100644 --- a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff @@ -7,8 +7,6 @@ let mut _0: (); let mut _3: *mut std::string::String; let mut _4: std::string::String; - scope 1 { - } bb0: { StorageLive(_3); diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff index ddc8cf9a3d9..cc9177c9002 100644 --- a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff @@ -7,8 +7,6 @@ let mut _0: (); let mut _3: *mut std::string::String; let mut _4: std::string::String; - scope 1 { - } bb0: { StorageLive(_3); diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 656934fce42..845673601b2 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -21,13 +21,9 @@ fn checked_shl(_1: u32, _2: u32) -> Option { debug self => _1; debug rhs => _2; let mut _3: u32; - scope 5 { - scope 6 (inlined core::num::::unchecked_shl) { - debug self => _1; - debug rhs => _3; - scope 7 { - } - } + scope 5 (inlined core::num::::unchecked_shl) { + debug self => _1; + debug rhs => _3; } } } diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir index ebe846e8a51..518fedffc16 100644 --- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir @@ -5,10 +5,8 @@ fn ub_if_b(_1: Thing) -> Thing { let mut _0: Thing; let mut _2: isize; scope 1 (inlined unreachable_unchecked) { - scope 2 { - } - scope 3 (inlined core::ub_checks::check_language_ub) { - scope 4 (inlined core::ub_checks::check_language_ub::runtime) { + scope 2 (inlined core::ub_checks::check_language_ub) { + scope 3 (inlined core::ub_checks::check_language_ub::runtime) { } } } diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index 0b5ed6ee169..cdb7eea74fb 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -26,10 +26,8 @@ fn int_range(_1: usize, _2: usize) -> () { let mut _12: usize; scope 6 { debug old => _11; - scope 7 { - } } - scope 8 (inlined std::cmp::impls::::lt) { + scope 7 (inlined std::cmp::impls::::lt) { debug self => _6; debug other => _7; let mut _8: usize; diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir index 26919dd98dd..c744787fce2 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir @@ -8,21 +8,15 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { debug dest => _1; debug src => _2; scope 2 { - scope 3 { - debug result => _0; - scope 6 (inlined std::ptr::write::) { - debug dst => _1; - debug src => _2; - scope 7 { - } - } - } - scope 4 (inlined std::ptr::read::) { - debug src => _1; - scope 5 { - } + debug result => _0; + scope 4 (inlined std::ptr::write::) { + debug dst => _1; + debug src => _2; } } + scope 3 (inlined std::ptr::read::) { + debug src => _1; + } } bb0: { diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir index 26919dd98dd..c744787fce2 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir @@ -8,21 +8,15 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { debug dest => _1; debug src => _2; scope 2 { - scope 3 { - debug result => _0; - scope 6 (inlined std::ptr::write::) { - debug dst => _1; - debug src => _2; - scope 7 { - } - } - } - scope 4 (inlined std::ptr::read::) { - debug src => _1; - scope 5 { - } + debug result => _0; + scope 4 (inlined std::ptr::write::) { + debug dst => _1; + debug src => _2; } } + scope 3 (inlined std::ptr::read::) { + debug src => _1; + } } bb0: { diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir index ed965770adb..002d55ad9d9 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -29,10 +29,8 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _13: u32; scope 6 { debug old => _12; - scope 7 { - } } - scope 8 (inlined std::cmp::impls::::lt) { + scope 7 (inlined std::cmp::impls::::lt) { debug self => _7; debug other => _8; let mut _9: u32; diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index a7ee9be19bd..d5021ac84d2 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -29,10 +29,8 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _13: u32; scope 6 { debug old => _12; - scope 7 { - } } - scope 8 (inlined std::cmp::impls::::lt) { + scope 7 (inlined std::cmp::impls::::lt) { debug self => _7; debug other => _8; let mut _9: u32; diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir index f674f6a3009..7faae1d863c 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir @@ -14,10 +14,8 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { let mut _8: u32; scope 3 { debug old => _7; - scope 4 { - } } - scope 5 (inlined std::cmp::impls::::lt) { + scope 4 (inlined std::cmp::impls::::lt) { debug self => _2; debug other => _3; let mut _4: u32; diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index a5029dcad3a..37f00533b60 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -14,10 +14,8 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { let mut _8: u32; scope 3 { debug old => _7; - scope 4 { - } } - scope 5 (inlined std::cmp::impls::::lt) { + scope 4 (inlined std::cmp::impls::::lt) { debug self => _2; debug other => _3; let mut _4: u32; diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index bcc540ae6fc..e5490955a36 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -9,8 +9,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug index => _2; let mut _3: *mut [u32]; let mut _4: *mut [u32]; - scope 2 { - } } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 1fe7da7d2fd..810fee9a149 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -9,8 +9,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug index => _2; let mut _3: *mut [u32]; let mut _4: *mut [u32]; - scope 2 { - } } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index f698e15d302..1ec85906385 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -37,52 +37,42 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _7: std::ptr::NonNull; scope 6 { debug ptr => _7; + let _11: *const T; scope 7 { - let _11: *const T; - scope 8 { - debug end_or_len => _11; - } - scope 14 (inlined without_provenance::) { - debug addr => _3; - scope 15 { - } - } - scope 16 (inlined NonNull::::as_ptr) { - debug self => _7; - } - scope 17 (inlined std::ptr::mut_ptr::::add) { - debug self => _9; - debug count => _3; - scope 18 { - } - } + debug end_or_len => _11; + } + scope 11 (inlined without_provenance::) { + debug addr => _3; + } + scope 12 (inlined NonNull::::as_ptr) { + debug self => _7; + } + scope 13 (inlined std::ptr::mut_ptr::::add) { + debug self => _9; + debug count => _3; } } - scope 9 (inlined as From<&[T]>>::from) { + scope 8 (inlined as From<&[T]>>::from) { debug reference => _1; let mut _4: *const [T]; - scope 10 { - } } - scope 11 (inlined NonNull::<[T]>::cast::) { + scope 9 (inlined NonNull::<[T]>::cast::) { debug self => _5; let mut _6: *const T; - scope 12 { - scope 13 (inlined NonNull::<[T]>::as_ptr) { - debug self => _5; - } + scope 10 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } } - scope 19 (inlined as Iterator>::enumerate) { + scope 14 (inlined as Iterator>::enumerate) { debug self => _13; - scope 20 (inlined Enumerate::>::new) { + scope 15 (inlined Enumerate::>::new) { debug iter => _13; } } - scope 21 (inlined > as IntoIterator>::into_iter) { + scope 16 (inlined > as IntoIterator>::into_iter) { debug self => _14; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index eae9f5909e6..70cdf3f41c2 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -37,52 +37,42 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _7: std::ptr::NonNull; scope 6 { debug ptr => _7; + let _11: *const T; scope 7 { - let _11: *const T; - scope 8 { - debug end_or_len => _11; - } - scope 14 (inlined without_provenance::) { - debug addr => _3; - scope 15 { - } - } - scope 16 (inlined NonNull::::as_ptr) { - debug self => _7; - } - scope 17 (inlined std::ptr::mut_ptr::::add) { - debug self => _9; - debug count => _3; - scope 18 { - } - } + debug end_or_len => _11; + } + scope 11 (inlined without_provenance::) { + debug addr => _3; + } + scope 12 (inlined NonNull::::as_ptr) { + debug self => _7; + } + scope 13 (inlined std::ptr::mut_ptr::::add) { + debug self => _9; + debug count => _3; } } - scope 9 (inlined as From<&[T]>>::from) { + scope 8 (inlined as From<&[T]>>::from) { debug reference => _1; let mut _4: *const [T]; - scope 10 { - } } - scope 11 (inlined NonNull::<[T]>::cast::) { + scope 9 (inlined NonNull::<[T]>::cast::) { debug self => _5; let mut _6: *const T; - scope 12 { - scope 13 (inlined NonNull::<[T]>::as_ptr) { - debug self => _5; - } + scope 10 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } } - scope 19 (inlined as Iterator>::enumerate) { + scope 14 (inlined as Iterator>::enumerate) { debug self => _13; - scope 20 (inlined Enumerate::>::new) { + scope 15 (inlined Enumerate::>::new) { debug iter => _13; } } - scope 21 (inlined > as IntoIterator>::into_iter) { + scope 16 (inlined > as IntoIterator>::into_iter) { debug self => _14; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index 158ae0de890..d8252e7267a 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -34,46 +34,36 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _7: std::ptr::NonNull; scope 6 { debug ptr => _7; + let _11: *const T; scope 7 { - let _11: *const T; - scope 8 { - debug end_or_len => _11; - } - scope 14 (inlined without_provenance::) { - debug addr => _3; - scope 15 { - } - } - scope 16 (inlined NonNull::::as_ptr) { - debug self => _7; - } - scope 17 (inlined std::ptr::mut_ptr::::add) { - debug self => _9; - debug count => _3; - scope 18 { - } - } + debug end_or_len => _11; + } + scope 11 (inlined without_provenance::) { + debug addr => _3; + } + scope 12 (inlined NonNull::::as_ptr) { + debug self => _7; + } + scope 13 (inlined std::ptr::mut_ptr::::add) { + debug self => _9; + debug count => _3; } } - scope 9 (inlined as From<&[T]>>::from) { + scope 8 (inlined as From<&[T]>>::from) { debug reference => _1; let mut _4: *const [T]; - scope 10 { - } } - scope 11 (inlined NonNull::<[T]>::cast::) { + scope 9 (inlined NonNull::<[T]>::cast::) { debug self => _5; let mut _6: *const T; - scope 12 { - scope 13 (inlined NonNull::<[T]>::as_ptr) { - debug self => _5; - } + scope 10 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } } - scope 19 (inlined as IntoIterator>::into_iter) { + scope 14 (inlined as IntoIterator>::into_iter) { debug self => _13; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index ac9e31a0da8..b3904dc70a6 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -34,46 +34,36 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _7: std::ptr::NonNull; scope 6 { debug ptr => _7; + let _11: *const T; scope 7 { - let _11: *const T; - scope 8 { - debug end_or_len => _11; - } - scope 14 (inlined without_provenance::) { - debug addr => _3; - scope 15 { - } - } - scope 16 (inlined NonNull::::as_ptr) { - debug self => _7; - } - scope 17 (inlined std::ptr::mut_ptr::::add) { - debug self => _9; - debug count => _3; - scope 18 { - } - } + debug end_or_len => _11; + } + scope 11 (inlined without_provenance::) { + debug addr => _3; + } + scope 12 (inlined NonNull::::as_ptr) { + debug self => _7; + } + scope 13 (inlined std::ptr::mut_ptr::::add) { + debug self => _9; + debug count => _3; } } - scope 9 (inlined as From<&[T]>>::from) { + scope 8 (inlined as From<&[T]>>::from) { debug reference => _1; let mut _4: *const [T]; - scope 10 { - } } - scope 11 (inlined NonNull::<[T]>::cast::) { + scope 9 (inlined NonNull::<[T]>::cast::) { debug self => _5; let mut _6: *const T; - scope 12 { - scope 13 (inlined NonNull::<[T]>::as_ptr) { - debug self => _5; - } + scope 10 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } } - scope 19 (inlined as IntoIterator>::into_iter) { + scope 14 (inlined as IntoIterator>::into_iter) { debug self => _13; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir index 543e8918e39..5ab88c9b855 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -35,10 +35,8 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _13: usize; scope 7 { debug old => _12; - scope 8 { - } } - scope 9 (inlined std::cmp::impls::::lt) { + scope 8 (inlined std::cmp::impls::::lt) { debug self => _7; debug other => _8; let mut _9: usize; diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index a16e9cd9e51..513651090a8 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -35,10 +35,8 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _13: usize; scope 7 { debug old => _12; - scope 8 { - } } - scope 9 (inlined std::cmp::impls::::lt) { + scope 8 (inlined std::cmp::impls::::lt) { debug self => _7; debug other => _8; let mut _9: usize; diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index 9550df012f8..091c8a0e968 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -19,7 +19,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 2 { debug x => _20; } - scope 22 (inlined > as Iterator>::next) { + scope 17 (inlined > as Iterator>::next) { debug self => _16; let mut _17: &mut std::slice::Iter<'_, T>; } @@ -39,52 +39,42 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _7: std::ptr::NonNull; scope 6 { debug ptr => _7; + let _11: *const T; scope 7 { - let _11: *const T; - scope 8 { - debug end_or_len => _11; - } - scope 14 (inlined without_provenance::) { - debug addr => _3; - scope 15 { - } - } - scope 16 (inlined NonNull::::as_ptr) { - debug self => _7; - } - scope 17 (inlined std::ptr::mut_ptr::::add) { - debug self => _9; - debug count => _3; - scope 18 { - } - } + debug end_or_len => _11; + } + scope 11 (inlined without_provenance::) { + debug addr => _3; + } + scope 12 (inlined NonNull::::as_ptr) { + debug self => _7; + } + scope 13 (inlined std::ptr::mut_ptr::::add) { + debug self => _9; + debug count => _3; } } - scope 9 (inlined as From<&[T]>>::from) { + scope 8 (inlined as From<&[T]>>::from) { debug reference => _1; let mut _4: *const [T]; - scope 10 { - } } - scope 11 (inlined NonNull::<[T]>::cast::) { + scope 9 (inlined NonNull::<[T]>::cast::) { debug self => _5; let mut _6: *const T; - scope 12 { - scope 13 (inlined NonNull::<[T]>::as_ptr) { - debug self => _5; - } + scope 10 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } } - scope 19 (inlined as Iterator>::rev) { + scope 14 (inlined as Iterator>::rev) { debug self => _13; - scope 20 (inlined Rev::>::new) { + scope 15 (inlined Rev::>::new) { debug iter => _13; } } - scope 21 (inlined > as IntoIterator>::into_iter) { + scope 16 (inlined > as IntoIterator>::into_iter) { debug self => _14; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index d75aabd12fc..1873d452f34 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -19,7 +19,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 2 { debug x => _20; } - scope 22 (inlined > as Iterator>::next) { + scope 17 (inlined > as Iterator>::next) { debug self => _16; let mut _17: &mut std::slice::Iter<'_, T>; } @@ -39,52 +39,42 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _7: std::ptr::NonNull; scope 6 { debug ptr => _7; + let _11: *const T; scope 7 { - let _11: *const T; - scope 8 { - debug end_or_len => _11; - } - scope 14 (inlined without_provenance::) { - debug addr => _3; - scope 15 { - } - } - scope 16 (inlined NonNull::::as_ptr) { - debug self => _7; - } - scope 17 (inlined std::ptr::mut_ptr::::add) { - debug self => _9; - debug count => _3; - scope 18 { - } - } + debug end_or_len => _11; + } + scope 11 (inlined without_provenance::) { + debug addr => _3; + } + scope 12 (inlined NonNull::::as_ptr) { + debug self => _7; + } + scope 13 (inlined std::ptr::mut_ptr::::add) { + debug self => _9; + debug count => _3; } } - scope 9 (inlined as From<&[T]>>::from) { + scope 8 (inlined as From<&[T]>>::from) { debug reference => _1; let mut _4: *const [T]; - scope 10 { - } } - scope 11 (inlined NonNull::<[T]>::cast::) { + scope 9 (inlined NonNull::<[T]>::cast::) { debug self => _5; let mut _6: *const T; - scope 12 { - scope 13 (inlined NonNull::<[T]>::as_ptr) { - debug self => _5; - } + scope 10 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } } - scope 19 (inlined as Iterator>::rev) { + scope 14 (inlined as Iterator>::rev) { debug self => _13; - scope 20 (inlined Rev::>::new) { + scope 15 (inlined Rev::>::new) { debug iter => _13; } } - scope 21 (inlined > as IntoIterator>::into_iter) { + scope 16 (inlined > as IntoIterator>::into_iter) { debug self => _14; } diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff index 747028e128f..859097d3966 100644 --- a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff @@ -25,8 +25,6 @@ let _7: i32; scope 5 { debug a => _7; - scope 6 { - } } } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index ce5ddbfdd12..1e6a168f756 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -6,218 +6,196 @@ debug multiple => _2; let mut _0: (); let _3: (); + let _4: usize; let _7: (); let mut _8: (); let _9: (); + let _10: usize; let mut _13: *const usize; let _15: (); let mut _16: (); let _17: (); + let _18: usize; let _22: (); let mut _23: &*const usize; let _24: (); + let _25: usize; let _29: (); let mut _30: *mut *const usize; let _31: (); + let _32: usize; let _35: (); let mut _36: *const usize; let _37: (); + let _38: usize; let _44: (); let mut _45: *const usize; let _46: (); + let _47: *const T; let _49: (); let mut _50: (); let _51: (); + let _52: *const T; let mut _53: *const T; let _55: (); let mut _56: (); let _57: (); + let _58: usize; let _62: (); let mut _63: (); let _64: (); + let _65: usize; let _69: (); let mut _70: (); + let _71: usize; let _75: (); let mut _76: (); scope 1 { - let _4: usize; + debug a => _4; + let _5: *const usize; scope 2 { - debug a => _4; - let _5: *const usize; + debug b => _5; + let _6: usize; scope 3 { - debug b => _5; - let _6: usize; - scope 4 { - debug c => _6; + debug c => _6; + } + } + } + scope 4 { + debug a => _10; + let _11: usize; + scope 5 { + debug a2 => _11; + let mut _12: *const usize; + scope 6 { + debug b => _12; + let _14: usize; + scope 7 { + debug c => _14; } } } } - scope 5 { - let _10: usize; - scope 6 { - debug a => _10; - let _11: usize; - scope 7 { - debug a2 => _11; - let mut _12: *const usize; - scope 8 { - debug b => _12; - let _14: usize; - scope 9 { - debug c => _14; - } + scope 8 { + debug a => _18; + let _19: *const usize; + scope 9 { + debug b => _19; + let _20: &*const usize; + scope 10 { + debug d => _20; + let _21: usize; + scope 11 { + debug c => _21; } } } } - scope 10 { - let _18: usize; - scope 11 { - debug a => _18; - let _19: *const usize; - scope 12 { - debug b => _19; - let _20: &*const usize; - scope 13 { - debug d => _20; - let _21: usize; - scope 14 { - debug c => _21; - } + scope 12 { + debug a => _25; + let mut _26: *const usize; + scope 13 { + debug b => _26; + let _27: *mut *const usize; + scope 14 { + debug d => _27; + let _28: usize; + scope 15 { + debug c => _28; } } } } - scope 15 { - let _25: usize; - scope 16 { - debug a => _25; - let mut _26: *const usize; - scope 17 { - debug b => _26; - let _27: *mut *const usize; - scope 18 { - debug d => _27; - let _28: usize; - scope 19 { - debug c => _28; - } - } + scope 16 { + debug a => _32; + let _33: *const usize; + scope 17 { + debug b => _33; + let _34: usize; + scope 18 { + debug c => _34; } } } - scope 20 { - let _32: usize; - scope 21 { - debug a => _32; - let _33: *const usize; - scope 22 { - debug b => _33; - let _34: usize; - scope 23 { - debug c => _34; - } - } - } - } - scope 24 { - let _38: usize; - scope 25 { - debug a => _38; - let _39: *const usize; - scope 26 { - debug b1 => _39; - let _40: usize; - scope 27 { - debug c => _40; - let _41: *const usize; - scope 28 { - debug b2 => _41; - let _42: usize; - scope 29 { - debug c2 => _42; - let _43: *const usize; - scope 30 { - debug b3 => _43; - } + scope 19 { + debug a => _38; + let _39: *const usize; + scope 20 { + debug b1 => _39; + let _40: usize; + scope 21 { + debug c => _40; + let _41: *const usize; + scope 22 { + debug b2 => _41; + let _42: usize; + scope 23 { + debug c2 => _42; + let _43: *const usize; + scope 24 { + debug b3 => _43; } } } } } } - scope 31 { - let _47: *const T; - scope 32 { -- debug a => _47; -+ debug a => _1; - let _48: T; - scope 33 { - debug b => _48; + scope 25 { +- debug a => _47; ++ debug a => _1; + let _48: T; + scope 26 { + debug b => _48; + } + } + scope 27 { + debug a => _52; + let _54: T; + scope 28 { + debug b => _54; + } + } + scope 29 { + debug a => _58; + let _59: *const usize; + scope 30 { + debug b => _59; + let _60: *const usize; + scope 31 { + debug c => _60; + let _61: usize; + scope 32 { + debug e => _61; + } } } } - scope 34 { - let _52: *const T; - scope 35 { - debug a => _52; - let _54: T; - scope 36 { - debug b => _54; + scope 33 { + debug a => _65; + let _66: *const usize; + scope 34 { + debug b => _66; + let _67: &*const usize; + scope 35 { + debug d => _67; + let _68: usize; + scope 36 { + debug c => _68; + } } } } scope 37 { - let _58: usize; + debug a => _71; + let mut _72: *const usize; scope 38 { - debug a => _58; - let _59: *const usize; + debug b => _72; + let _73: &mut *const usize; scope 39 { - debug b => _59; - let _60: *const usize; + debug d => _73; + let _74: usize; scope 40 { - debug c => _60; - let _61: usize; - scope 41 { - debug e => _61; - } - } - } - } - } - scope 42 { - let _65: usize; - scope 43 { - debug a => _65; - let _66: *const usize; - scope 44 { - debug b => _66; - let _67: &*const usize; - scope 45 { - debug d => _67; - let _68: usize; - scope 46 { - debug c => _68; - } - } - } - } - } - scope 47 { - let _71: usize; - scope 48 { - debug a => _71; - let mut _72: *const usize; - scope 49 { - debug b => _72; - let _73: &mut *const usize; - scope 50 { - debug d => _73; - let _74: usize; - scope 51 { - debug c => _74; - } + debug c => _74; } } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index b6b2acc0b43..5629d04f1b1 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -6,197 +6,177 @@ debug multiple => _2; let mut _0: (); let _3: (); + let mut _4: usize; let _7: (); let mut _8: (); let _9: (); + let mut _10: usize; let mut _13: *mut usize; let _15: (); let mut _16: (); let _17: (); + let mut _18: usize; let _22: (); let mut _23: &*mut usize; let _24: (); + let mut _25: usize; let _29: (); let mut _30: *mut *mut usize; let _31: (); + let mut _32: usize; let _35: (); let mut _36: *mut usize; let _37: (); + let mut _38: usize; let _44: (); let mut _45: *mut usize; let _46: (); + let _47: *mut T; let _49: (); let mut _50: (); let _51: (); + let _52: *mut T; let mut _53: *mut T; let _55: (); let mut _56: (); let _57: (); + let mut _58: usize; let _62: (); let mut _63: (); + let mut _64: usize; let _68: (); let mut _69: (); scope 1 { - let mut _4: usize; + debug a => _4; + let _5: *mut usize; scope 2 { - debug a => _4; - let _5: *mut usize; + debug b => _5; + let _6: usize; scope 3 { - debug b => _5; - let _6: usize; - scope 4 { - debug c => _6; + debug c => _6; + } + } + } + scope 4 { + debug a => _10; + let mut _11: usize; + scope 5 { + debug a2 => _11; + let mut _12: *mut usize; + scope 6 { + debug b => _12; + let _14: usize; + scope 7 { + debug c => _14; } } } } - scope 5 { - let mut _10: usize; - scope 6 { - debug a => _10; - let mut _11: usize; - scope 7 { - debug a2 => _11; - let mut _12: *mut usize; - scope 8 { - debug b => _12; - let _14: usize; - scope 9 { - debug c => _14; - } + scope 8 { + debug a => _18; + let _19: *mut usize; + scope 9 { + debug b => _19; + let _20: &*mut usize; + scope 10 { + debug d => _20; + let _21: usize; + scope 11 { + debug c => _21; } } } } - scope 10 { - let mut _18: usize; - scope 11 { - debug a => _18; - let _19: *mut usize; - scope 12 { - debug b => _19; - let _20: &*mut usize; - scope 13 { - debug d => _20; - let _21: usize; - scope 14 { - debug c => _21; - } + scope 12 { + debug a => _25; + let mut _26: *mut usize; + scope 13 { + debug b => _26; + let _27: *mut *mut usize; + scope 14 { + debug d => _27; + let _28: usize; + scope 15 { + debug c => _28; } } } } - scope 15 { - let mut _25: usize; - scope 16 { - debug a => _25; - let mut _26: *mut usize; - scope 17 { - debug b => _26; - let _27: *mut *mut usize; - scope 18 { - debug d => _27; - let _28: usize; - scope 19 { - debug c => _28; - } - } + scope 16 { + debug a => _32; + let _33: *mut usize; + scope 17 { + debug b => _33; + let _34: usize; + scope 18 { + debug c => _34; } } } - scope 20 { - let mut _32: usize; - scope 21 { - debug a => _32; - let _33: *mut usize; - scope 22 { - debug b => _33; - let _34: usize; - scope 23 { - debug c => _34; - } - } - } - } - scope 24 { - let mut _38: usize; - scope 25 { - debug a => _38; - let _39: *mut usize; - scope 26 { - debug b1 => _39; - let _40: usize; - scope 27 { - debug c => _40; - let _41: *mut usize; - scope 28 { - debug b2 => _41; - let _42: usize; - scope 29 { - debug c2 => _42; - let _43: *mut usize; - scope 30 { - debug b3 => _43; - } + scope 19 { + debug a => _38; + let _39: *mut usize; + scope 20 { + debug b1 => _39; + let _40: usize; + scope 21 { + debug c => _40; + let _41: *mut usize; + scope 22 { + debug b2 => _41; + let _42: usize; + scope 23 { + debug c2 => _42; + let _43: *mut usize; + scope 24 { + debug b3 => _43; } } } } } } - scope 31 { - let _47: *mut T; - scope 32 { -- debug a => _47; -+ debug a => _1; - let _48: T; - scope 33 { - debug b => _48; - } + scope 25 { +- debug a => _47; ++ debug a => _1; + let _48: T; + scope 26 { + debug b => _48; } } - scope 34 { - let _52: *mut T; - scope 35 { - debug a => _52; - let _54: T; - scope 36 { - debug b => _54; - } + scope 27 { + debug a => _52; + let _54: T; + scope 28 { + debug b => _54; } } - scope 37 { - let mut _58: usize; - scope 38 { - debug a => _58; - let _59: *mut usize; - scope 39 { - debug b => _59; - let _60: &*mut usize; - scope 40 { - debug d => _60; - let _61: usize; - scope 41 { - debug c => _61; - } + scope 29 { + debug a => _58; + let _59: *mut usize; + scope 30 { + debug b => _59; + let _60: &*mut usize; + scope 31 { + debug d => _60; + let _61: usize; + scope 32 { + debug c => _61; } } } } - scope 42 { - let mut _64: usize; - scope 43 { - debug a => _64; - let mut _65: *mut usize; - scope 44 { - debug b => _65; - let _66: &mut *mut usize; - scope 45 { - debug d => _66; - let _67: usize; - scope 46 { - debug c => _67; - } + scope 33 { + debug a => _64; + let mut _65: *mut usize; + scope 34 { + debug b => _65; + let _66: &mut *mut usize; + scope 35 { + debug d => _66; + let _67: usize; + scope 36 { + debug c => _67; } } } diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff index b4912a918ba..a5427cea1f8 100644 --- a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff @@ -12,16 +12,12 @@ scope 1 { - debug y => _1; + debug y => _3; - scope 5 { - } } scope 2 { debug a => _2; let _3: *mut i32; scope 3 { debug x => _3; - scope 4 { - } } } diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir index 7124b4c1cd8..f9d58ea60a3 100644 --- a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -36,22 +36,18 @@ fn array_casts() -> () { debug p => _2; let _8: [usize; 2]; scope 3 { - } - scope 4 { debug x => _8; let _9: *const usize; - scope 5 { + scope 4 { debug p => _9; let _20: &usize; let _21: &usize; let mut _34: &usize; - scope 6 { - } - scope 7 { + scope 5 { debug left_val => _20; debug right_val => _21; let _26: core::panicking::AssertKind; - scope 8 { + scope 6 { debug kind => _26; } } diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index be04757f2a3..b0b70cd5d91 100644 --- a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -36,22 +36,18 @@ fn array_casts() -> () { debug p => _2; let _8: [usize; 2]; scope 3 { - } - scope 4 { debug x => _8; let _9: *const usize; - scope 5 { + scope 4 { debug p => _9; let _20: &usize; let _21: &usize; let mut _34: &usize; - scope 6 { - } - scope 7 { + scope 5 { debug left_val => _20; debug right_val => _21; let _26: core::panicking::AssertKind; - scope 8 { + scope 6 { debug kind => _26; } } diff --git a/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff index a903e8d789e..526ff2f25cf 100644 --- a/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff @@ -5,8 +5,6 @@ let mut _0: (); - let _1: u32; - let mut _2: *mut u32; - scope 1 { - } bb0: { - StorageLive(_1); diff --git a/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff index e72e71a13a2..a88f6d40115 100644 --- a/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff @@ -5,8 +5,6 @@ let mut _0: (); - let _1: &mut u32; - let mut _2: *mut u32; - scope 1 { - } bb0: { - StorageLive(_1); diff --git a/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff index 37c367c82ca..5d45d7ac781 100644 --- a/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff @@ -6,8 +6,6 @@ - let _1: u32; - let mut _2: &mut u32; - let mut _3: *mut u32; - scope 1 { - } bb0: { - StorageLive(_1); diff --git a/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff index 006e3c4232d..4f4855dbaaf 100644 --- a/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff @@ -5,8 +5,6 @@ let mut _0: u32; let mut _1: u32; let mut _2: *mut u32; - scope 1 { - } bb0: { StorageLive(_1); diff --git a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff index 6c99d3efd29..2f8dfcc5d63 100644 --- a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff @@ -6,8 +6,6 @@ let mut _0: u32; let mut _2: unions::Repr; let mut _3: f32; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/mir-opt/tls_access.main.PreCodegen.after.mir b/tests/mir-opt/tls_access.main.PreCodegen.after.mir index 43c7051f027..1c59e938423 100644 --- a/tests/mir-opt/tls_access.main.PreCodegen.after.mir +++ b/tests/mir-opt/tls_access.main.PreCodegen.after.mir @@ -3,12 +3,10 @@ fn main() -> () { let mut _0: (); let _1: *mut u8; + let _2: &u8; let mut _3: *mut u8; scope 1 { - let _2: &u8; - scope 2 { - debug a => _2; - } + debug a => _2; } bb0: { diff --git a/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir index 89f7016fee4..240f409817d 100644 --- a/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir +++ b/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir @@ -7,8 +7,6 @@ fn process_never(_1: *const !) -> () { scope 1 { debug _input => _2; } - scope 2 { - } bb0: { unreachable; diff --git a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir index 51905f982b8..51514ba5e5d 100644 --- a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir +++ b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir @@ -6,8 +6,6 @@ fn process_void(_1: *const Void) -> () { scope 1 { debug _input => _1; } - scope 2 { - } bb0: { return; diff --git a/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir b/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir index 8edc7b5df88..f0311422c17 100644 --- a/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir @@ -11,8 +11,6 @@ fn bar(_1: Bar) -> () { let mut _7: bool; let _8: (); let mut _9: [u8; 1]; - scope 1 { - } bb0: { StorageLive(_2); diff --git a/tests/ui/asm/x86_64/goto.rs b/tests/ui/asm/x86_64/goto.rs index 6a567efbb2c..6c14bb57ac6 100644 --- a/tests/ui/asm/x86_64/goto.rs +++ b/tests/ui/asm/x86_64/goto.rs @@ -1,8 +1,6 @@ //@ only-x86_64 //@ run-pass //@ needs-asm-support -//@ revisions: mirunsafeck thirunsafeck -//@ [thirunsafeck]compile-flags: -Z thir-unsafeck #![deny(unreachable_code)] #![feature(asm_goto)] diff --git a/tests/ui/asm/x86_64/goto.mirunsafeck.stderr b/tests/ui/asm/x86_64/goto.stderr similarity index 92% rename from tests/ui/asm/x86_64/goto.mirunsafeck.stderr rename to tests/ui/asm/x86_64/goto.stderr index fe189c14f0a..27e227d71a5 100644 --- a/tests/ui/asm/x86_64/goto.mirunsafeck.stderr +++ b/tests/ui/asm/x86_64/goto.stderr @@ -1,5 +1,5 @@ warning: unreachable statement - --> $DIR/goto.rs:99:9 + --> $DIR/goto.rs:97:9 | LL | / asm!( LL | | "jmp {}", @@ -13,7 +13,7 @@ LL | unreachable!(); | ^^^^^^^^^^^^^^ unreachable statement | note: the lint level is defined here - --> $DIR/goto.rs:89:8 + --> $DIR/goto.rs:87:8 | LL | #[warn(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/asm/x86_64/goto.thirunsafeck.stderr b/tests/ui/asm/x86_64/goto.thirunsafeck.stderr deleted file mode 100644 index fe189c14f0a..00000000000 --- a/tests/ui/asm/x86_64/goto.thirunsafeck.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: unreachable statement - --> $DIR/goto.rs:99:9 - | -LL | / asm!( -LL | | "jmp {}", -LL | | label { -LL | | return; -LL | | }, -LL | | options(noreturn) -LL | | ); - | |_________- any code following this expression is unreachable -LL | unreachable!(); - | ^^^^^^^^^^^^^^ unreachable statement - | -note: the lint level is defined here - --> $DIR/goto.rs:89:8 - | -LL | #[warn(unreachable_code)] - | ^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 1 warning emitted -