diff options
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/add_retag.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/check_unsafety.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 23 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop_lint.rs | 25 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/deref_separator.rs | 134 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/early_otherwise_branch.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/generator.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/match_branches.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/pass_manager.rs | 21 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/simplify_comparison_integral.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/simplify_try.rs | 14 |
12 files changed, 144 insertions, 110 deletions
diff --git a/compiler/rustc_mir_transform/src/add_retag.rs b/compiler/rustc_mir_transform/src/add_retag.rs index 28a5a22dd9d..a245da658b9 100644 --- a/compiler/rustc_mir_transform/src/add_retag.rs +++ b/compiler/rustc_mir_transform/src/add_retag.rs @@ -57,6 +57,17 @@ fn may_be_reference(ty: Ty<'_>) -> bool { } } +/// Determines whether or not this LocalDecl is temp, if not it needs retagging. +fn is_not_temp<'tcx>(local_decl: &LocalDecl<'tcx>) -> bool { + if let Some(local_info) = &local_decl.local_info { + match local_info.as_ref() { + LocalInfo::DerefTemp => return false, + _ => (), + }; + } + return true; +} + impl<'tcx> MirPass<'tcx> for AddRetag { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { sess.opts.debugging_opts.mir_emit_retag @@ -71,7 +82,9 @@ impl<'tcx> MirPass<'tcx> for AddRetag { let needs_retag = |place: &Place<'tcx>| { // FIXME: Instead of giving up for unstable places, we should introduce // a temporary and retag on that. - is_stable(place.as_ref()) && may_be_reference(place.ty(&*local_decls, tcx).ty) + is_stable(place.as_ref()) + && may_be_reference(place.ty(&*local_decls, tcx).ty) + && is_not_temp(&local_decls[place.local]) }; let place_base_raw = |place: &Place<'tcx>| { // If this is a `Deref`, get the type of what we are deref'ing. diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs index 1b4510b6220..dde79214b16 100644 --- a/compiler/rustc_mir_transform/src/check_unsafety.rs +++ b/compiler/rustc_mir_transform/src/check_unsafety.rs @@ -70,6 +70,8 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> { 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( @@ -78,7 +80,7 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> { ) } - if let ty::FnDef(func_id, _) = func_ty.kind() { + if let Some(func_id) = func_id { self.check_target_features(*func_id); } } diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 13b49256d48..f7535d338da 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -313,9 +313,7 @@ struct ConstPropagator<'mir, 'tcx> { ecx: InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, - // FIXME(eddyb) avoid cloning this field more than once, - // by accessing it through `ecx` instead. - local_decls: IndexVec<Local, LocalDecl<'tcx>>, + local_decls: &'mir IndexVec<Local, LocalDecl<'tcx>>, // Because we have `MutVisitor` we can't obtain the `SourceInfo` from a `Location`. So we store // the last known `SourceInfo` here and just keep revisiting it. source_info: Option<SourceInfo>, @@ -361,10 +359,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let substs = &InternalSubsts::identity_for_item(tcx, def_id); let param_env = tcx.param_env_reveal_all_normalized(def_id); - let span = tcx.def_span(def_id); - // FIXME: `CanConstProp::check` computes the layout of all locals, return those layouts - // so we can write them to `ecx.frame_mut().locals.layout, reducing the duplication in - // `layout_of` query invocations. let can_const_prop = CanConstProp::check(tcx, param_env, body); let mut only_propagate_inside_block_locals = BitSet::new_empty(can_const_prop.len()); for (l, mode) in can_const_prop.iter_enumerated() { @@ -374,7 +368,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } let mut ecx = InterpCx::new( tcx, - span, + tcx.def_span(def_id), param_env, ConstPropMachine::new(only_propagate_inside_block_locals, can_const_prop), ); @@ -405,10 +399,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { ecx, tcx, param_env, - // FIXME(eddyb) avoid cloning this field more than once, - // by accessing it through `ecx` instead. - //FIXME(wesleywiser) we can't steal this because `Visitor::super_visit_body()` needs it - local_decls: body.local_decls.clone(), + local_decls: &dummy_body.local_decls, source_info: None, } } @@ -424,7 +415,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { // Try to read the local as an immediate so that if it is representable as a scalar, we can // handle it as such, but otherwise, just return the value as is. - Some(match self.ecx.try_read_immediate(&op) { + Some(match self.ecx.read_immediate_raw(&op, /*force*/ false) { Ok(Ok(imm)) => imm.into(), _ => op, }) @@ -511,7 +502,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let r = r?; // We need the type of the LHS. We cannot use `place_layout` as that is the type // of the result, which for checked binops is not the same! - let left_ty = left.ty(&self.local_decls, self.tcx); + let left_ty = left.ty(self.local_decls, self.tcx); let left_size = self.ecx.layout_of(left_ty).ok()?.size; let right_size = r.layout.size; let r_bits = r.to_scalar().ok(); @@ -718,8 +709,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { return; } - // FIXME> figure out what to do when try_read_immediate fails - let imm = self.use_ecx(|this| this.ecx.try_read_immediate(value)); + // FIXME> figure out what to do when read_immediate_raw fails + let imm = self.use_ecx(|this| this.ecx.read_immediate_raw(value, /*force*/ false)); if let Some(Ok(imm)) = imm { match *imm { diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs index d6331a88c5b..aa898cfd3ba 100644 --- a/compiler/rustc_mir_transform/src/const_prop_lint.rs +++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs @@ -308,10 +308,8 @@ struct ConstPropagator<'mir, 'tcx> { ecx: InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, - // FIXME(eddyb) avoid cloning these two fields more than once, - // by accessing them through `ecx` instead. - source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>, - local_decls: IndexVec<Local, LocalDecl<'tcx>>, + source_scopes: &'mir IndexVec<SourceScope, SourceScopeData<'tcx>>, + local_decls: &'mir IndexVec<Local, LocalDecl<'tcx>>, // Because we have `MutVisitor` we can't obtain the `SourceInfo` from a `Location`. So we store // the last known `SourceInfo` here and just keep revisiting it. source_info: Option<SourceInfo>, @@ -357,10 +355,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let substs = &InternalSubsts::identity_for_item(tcx, def_id); let param_env = tcx.param_env_reveal_all_normalized(def_id); - let span = tcx.def_span(def_id); - // FIXME: `CanConstProp::check` computes the layout of all locals, return those layouts - // so we can write them to `ecx.frame_mut().locals.layout, reducing the duplication in - // `layout_of` query invocations. let can_const_prop = CanConstProp::check(tcx, param_env, body); let mut only_propagate_inside_block_locals = BitSet::new_empty(can_const_prop.len()); for (l, mode) in can_const_prop.iter_enumerated() { @@ -370,7 +364,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } let mut ecx = InterpCx::new( tcx, - span, + tcx.def_span(def_id), param_env, ConstPropMachine::new(only_propagate_inside_block_locals, can_const_prop), ); @@ -401,11 +395,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { ecx, tcx, param_env, - // FIXME(eddyb) avoid cloning these two fields more than once, - // by accessing them through `ecx` instead. - source_scopes: body.source_scopes.clone(), - //FIXME(wesleywiser) we can't steal this because `Visitor::super_visit_body()` needs it - local_decls: body.local_decls.clone(), + source_scopes: &dummy_body.source_scopes, + local_decls: &dummy_body.local_decls, source_info: None, } } @@ -421,7 +412,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { // Try to read the local as an immediate so that if it is representable as a scalar, we can // handle it as such, but otherwise, just return the value as is. - Some(match self.ecx.try_read_immediate(&op) { + Some(match self.ecx.read_immediate_raw(&op, /*force*/ false) { Ok(Ok(imm)) => imm.into(), _ => op, }) @@ -435,7 +426,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } fn lint_root(&self, source_info: SourceInfo) -> Option<HirId> { - source_info.scope.lint_root(&self.source_scopes) + source_info.scope.lint_root(self.source_scopes) } fn use_ecx<F, T>(&mut self, f: F) -> Option<T> @@ -572,7 +563,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let r = r?; // We need the type of the LHS. We cannot use `place_layout` as that is the type // of the result, which for checked binops is not the same! - let left_ty = left.ty(&self.local_decls, self.tcx); + let left_ty = left.ty(self.local_decls, self.tcx); let left_size = self.ecx.layout_of(left_ty).ok()?.size; let right_size = r.layout.size; let r_bits = r.to_scalar().ok(); diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs index 24b626ad966..57a95a67df7 100644 --- a/compiler/rustc_mir_transform/src/deref_separator.rs +++ b/compiler/rustc_mir_transform/src/deref_separator.rs @@ -1,68 +1,92 @@ use crate::MirPass; +use rustc_index::vec::IndexVec; use rustc_middle::mir::patch::MirPatch; +use rustc_middle::mir::visit::{MutVisitor, PlaceContext}; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; pub struct Derefer; -pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let mut patch = MirPatch::new(body); - let (basic_blocks, local_decl) = body.basic_blocks_and_local_decls_mut(); - for (block, data) in basic_blocks.iter_enumerated_mut() { - for (i, stmt) in data.statements.iter_mut().enumerate() { - match stmt.kind { - StatementKind::Assign(box (og_place, Rvalue::Ref(region, borrow_knd, place))) => { - let mut place_local = place.local; - let mut last_len = 0; - for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() { - if p_elem == ProjectionElem::Deref && !p_ref.projection.is_empty() { - // The type that we are derefing. - let ty = p_ref.ty(local_decl, tcx).ty; - let temp = patch.new_temp(ty, stmt.source_info.span); - - // Because we are assigning this right before original statement - // we are using index i of statement. - let loc = Location { block: block, statement_index: i }; - patch.add_statement(loc, StatementKind::StorageLive(temp)); - - // We are adding current p_ref's projections to our - // temp value, excluding projections we already covered. - let deref_place = Place::from(place_local) - .project_deeper(&p_ref.projection[last_len..], tcx); - patch.add_assign( - loc, - Place::from(temp), - Rvalue::Use(Operand::Move(deref_place)), - ); - - place_local = temp; - last_len = p_ref.projection.len(); - - // We are creating a place by using our temp value's location - // and copying derefed values which we need to create new statement. - let temp_place = - Place::from(temp).project_deeper(&place.projection[idx..], tcx); - let new_stmt = Statement { - source_info: stmt.source_info, - kind: StatementKind::Assign(Box::new(( - og_place, - Rvalue::Ref(region, borrow_knd, temp_place), - ))), - }; - - // Replace current statement with newly created one. - *stmt = new_stmt; - - // Since our job with the temp is done it should be gone - let loc = Location { block: block, statement_index: i + 1 }; - patch.add_statement(loc, StatementKind::StorageDead(temp)); - } - } +pub struct DerefChecker<'tcx> { + tcx: TyCtxt<'tcx>, + patcher: MirPatch<'tcx>, + local_decls: IndexVec<Local, LocalDecl<'tcx>>, +} + +impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> { + fn tcx(&self) -> TyCtxt<'tcx> { + self.tcx + } + + fn visit_place(&mut self, place: &mut Place<'tcx>, _: PlaceContext, loc: Location) { + let mut place_local = place.local; + let mut last_len = 0; + let mut last_deref_idx = 0; + + let mut prev_temp: Option<Local> = None; + + for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() { + if p_elem == ProjectionElem::Deref && !p_ref.projection.is_empty() { + last_deref_idx = idx; + } + } + + for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() { + if p_elem == ProjectionElem::Deref && !p_ref.projection.is_empty() { + let ty = p_ref.ty(&self.local_decls, self.tcx).ty; + let temp = self.patcher.new_local_with_info( + ty, + self.local_decls[p_ref.local].source_info.span, + Some(Box::new(LocalInfo::DerefTemp)), + ); + + self.patcher.add_statement(loc, StatementKind::StorageLive(temp)); + + // We are adding current p_ref's projections to our + // temp value, excluding projections we already covered. + let deref_place = Place::from(place_local) + .project_deeper(&p_ref.projection[last_len..], self.tcx); + + self.patcher.add_assign( + loc, + Place::from(temp), + Rvalue::Use(Operand::Move(deref_place)), + ); + place_local = temp; + last_len = p_ref.projection.len(); + + // Change `Place` only if we are actually at the Place's last deref + if idx == last_deref_idx { + let temp_place = + Place::from(temp).project_deeper(&place.projection[idx..], self.tcx); + *place = temp_place; + } + + // We are destroying the previous temp since it's no longer used. + if let Some(prev_temp) = prev_temp { + self.patcher.add_statement(loc, StatementKind::StorageDead(prev_temp)); } - _ => (), + + prev_temp = Some(temp); } } + + // Since we won't be able to reach final temp, we destroy it outside the loop. + if let Some(prev_temp) = prev_temp { + let last_loc = Location { block: loc.block, statement_index: loc.statement_index + 1 }; + self.patcher.add_statement(last_loc, StatementKind::StorageDead(prev_temp)); + } } - patch.apply(body); +} + +pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { + let patch = MirPatch::new(body); + let mut checker = DerefChecker { tcx, patcher: patch, local_decls: body.local_decls.clone() }; + + for (bb, data) in body.basic_blocks_mut().iter_enumerated_mut() { + checker.visit_basic_block_data(bb, data); + } + + checker.patcher.apply(body); } impl<'tcx> MirPass<'tcx> for Derefer { diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs index 5bde0c01412..33f201cbd28 100644 --- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs +++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs @@ -336,9 +336,7 @@ fn evaluate_candidate<'tcx>( Some(poss) } }; - let Some((_, child)) = targets.iter().next() else { - return None - }; + let (_, child) = targets.iter().next()?; let child_terminator = &bbs[child].terminator(); let TerminatorKind::SwitchInt { switch_ty: child_ty, diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index 144ea0ec619..d5d4bfa255b 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -18,13 +18,13 @@ //! First upvars are stored //! It is followed by the generator state field. //! Then finally the MIR locals which are live across a suspension point are stored. -//! +//! ```ignore (illustrative) //! struct Generator { //! upvars..., //! state: u32, //! mir_locals..., //! } -//! +//! ``` //! This pass computes the meaning of the state field and the MIR locals which are live //! across a suspension point. There are however three hardcoded generator states: //! 0 - Generator have not been resumed yet diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index d395ccd3819..40cc6dafe61 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -426,13 +426,13 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc &add_moves_for_packed_drops::AddMovesForPackedDrops, // `AddRetag` needs to run after `ElaborateDrops`. Otherwise it should run fairly late, // but before optimizations begin. + &deref_separator::Derefer, &add_retag::AddRetag, &lower_intrinsics::LowerIntrinsics, &simplify::SimplifyCfg::new("elaborate-drops"), // `Deaggregator` is conceptually part of MIR building, some backends rely on it happening // and it can help optimizations. &deaggregator::Deaggregator, - &deref_separator::Derefer, &Lint(const_prop_lint::ConstProp), ]; diff --git a/compiler/rustc_mir_transform/src/match_branches.rs b/compiler/rustc_mir_transform/src/match_branches.rs index 3c14a324c36..7cd7d26328a 100644 --- a/compiler/rustc_mir_transform/src/match_branches.rs +++ b/compiler/rustc_mir_transform/src/match_branches.rs @@ -14,7 +14,7 @@ pub struct MatchBranchSimplification; /// /// For example: /// -/// ```rust +/// ```ignore (MIR) /// bb0: { /// switchInt(move _3) -> [42_isize: bb1, otherwise: bb2]; /// } @@ -32,7 +32,7 @@ pub struct MatchBranchSimplification; /// /// into: /// -/// ```rust +/// ```ignore (MIR) /// bb0: { /// _2 = Eq(move _3, const 42_isize); /// goto -> bb3; diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index 740a2168b41..2380391d09a 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -77,17 +77,30 @@ pub fn run_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn let mut cnt = 0; let validate = tcx.sess.opts.debugging_opts.validate_mir; + let overridden_passes = &tcx.sess.opts.debugging_opts.mir_enable_passes; + trace!(?overridden_passes); if validate { validate_body(tcx, body, format!("start of phase transition from {:?}", start_phase)); } for pass in passes { - if !pass.is_enabled(&tcx.sess) { - continue; - } - let name = pass.name(); + + if let Some((_, polarity)) = overridden_passes.iter().rev().find(|(s, _)| s == &*name) { + trace!( + pass = %name, + "{} as requested by flag", + if *polarity { "Running" } else { "Not running" }, + ); + if !polarity { + continue; + } + } else { + if !pass.is_enabled(&tcx.sess) { + continue; + } + } let dump_enabled = pass.is_mir_dump_enabled(); if dump_enabled { diff --git a/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs b/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs index da683a33651..bbfaace7041 100644 --- a/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs +++ b/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs @@ -12,7 +12,7 @@ use rustc_middle::{ /// Pass to convert `if` conditions on integrals into switches on the integral. /// For an example, it turns something like /// -/// ``` +/// ```ignore (MIR) /// _3 = Eq(move _4, const 43i32); /// StorageDead(_4); /// switchInt(_3) -> [false: bb2, otherwise: bb3]; @@ -20,7 +20,7 @@ use rustc_middle::{ /// /// into: /// -/// ``` +/// ```ignore (MIR) /// switchInt(_4) -> [43i32: bb3, otherwise: bb2]; /// ``` pub struct SimplifyComparisonIntegral; diff --git a/compiler/rustc_mir_transform/src/simplify_try.rs b/compiler/rustc_mir_transform/src/simplify_try.rs index ce4b45062e8..b3d45c7a221 100644 --- a/compiler/rustc_mir_transform/src/simplify_try.rs +++ b/compiler/rustc_mir_transform/src/simplify_try.rs @@ -1,10 +1,12 @@ //! The general point of the optimizations provided here is to simplify something like: //! //! ```rust +//! # fn foo<T, E>(x: Result<T, E>) -> Result<T, E> { //! match x { //! Ok(x) => Ok(x), //! Err(x) => Err(x) //! } +//! # } //! ``` //! //! into just `x`. @@ -23,7 +25,7 @@ use std::slice::Iter; /// /// This is done by transforming basic blocks where the statements match: /// -/// ```rust +/// ```ignore (MIR) /// _LOCAL_TMP = ((_LOCAL_1 as Variant ).FIELD: TY ); /// _TMP_2 = _LOCAL_TMP; /// ((_LOCAL_0 as Variant).FIELD: TY) = move _TMP_2; @@ -32,7 +34,7 @@ use std::slice::Iter; /// /// into: /// -/// ```rust +/// ```ignore (MIR) /// _LOCAL_0 = move _LOCAL_1 /// ``` pub struct SimplifyArmIdentity; @@ -472,7 +474,7 @@ impl Visitor<'_> for LocalUseCounter { } /// Match on: -/// ```rust +/// ```ignore (MIR) /// _LOCAL_INTO = ((_LOCAL_FROM as Variant).FIELD: TY); /// ``` fn match_get_variant_field<'tcx>( @@ -492,7 +494,7 @@ fn match_get_variant_field<'tcx>( } /// Match on: -/// ```rust +/// ```ignore (MIR) /// ((_LOCAL_FROM as Variant).FIELD: TY) = move _LOCAL_INTO; /// ``` fn match_set_variant_field<'tcx>(stmt: &Statement<'tcx>) -> Option<(Local, Local, VarField<'tcx>)> { @@ -507,7 +509,7 @@ fn match_set_variant_field<'tcx>(stmt: &Statement<'tcx>) -> Option<(Local, Local } /// Match on: -/// ```rust +/// ```ignore (MIR) /// discriminant(_LOCAL_TO_SET) = VAR_IDX; /// ``` fn match_set_discr(stmt: &Statement<'_>) -> Option<(Local, VariantIdx)> { @@ -690,7 +692,7 @@ impl<'tcx> SimplifyBranchSameOptimizationFinder<'_, 'tcx> { /// /// Statements can be trivially equal if the kinds match. /// But they can also be considered equal in the following case A: - /// ``` + /// ```ignore (MIR) /// discriminant(_0) = 0; // bb1 /// _0 = move _1; // bb2 /// ``` |
