1
Fork 0

Auto merge of #96451 - JakobDegen:dest-prop, r=tmiasko

Fix Dest Prop

Closes #82678, #79191 .

This was not originally a total re-write of the pass but is has gradually turned into one. Notable changes:

 1. Significant improvements to documentation all around. The top of the file has been extended with a more precise argument for soundness. The code should be fairly readable, and I've done my best to add useful comments wherever possible. I would very much like for the bus factor to not be one on this code.
 3. Improved handling of conflicts that are not visible in normal dataflow.  This was the cause of #79191. Handling this correctly requires us to make decision about the semantics and specifically evaluation order of basically all MIR constructs (see specifically #68364 #71117.  The way this is implemented is based on my preferred resolution to these questions around the semantics of assignment statements.
 4. Some re-architecting to improve performance. More details below.
 5. Possible future improvements to this optimization are documented, and the code is written with the needs of those improvements in mind. The hope is that adding support for more precise analyses will not require a full re-write of this opt, but just localized changes.

### Regarding Performance

The previous approach had some performance issues; letting `l` be the number of locals and `s` be the number of statements/terminators, the runtime of the pass was `O(l^2 * s)`, both in theory and in practice. This version is smarter about not calculating unnecessary things and doing more caching. Our runtime is now dominated by one invocation of `MaybeLiveLocals` for each "round," and the number of rounds is less than 5 in over 90% of cases. This means it's linear-ish in practice.

r? `@oli-obk` who reviewed the last version of this, but review from anyone else would be more than welcome
This commit is contained in:
bors 2022-11-27 04:09:53 +00:00
commit 0e9eee6811
40 changed files with 1046 additions and 1231 deletions

View file

@ -1,122 +0,0 @@
//! A less precise version of `MaybeInitializedPlaces` whose domain is entire locals.
//!
//! A local will be maybe initialized if *any* projections of that local might be initialized.
use crate::{CallReturnPlaces, GenKill};
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::mir::{self, BasicBlock, Local, Location};
pub struct MaybeInitializedLocals;
impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeInitializedLocals {
type Domain = BitSet<Local>;
const NAME: &'static str = "maybe_init_locals";
fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
// bottom = uninit
BitSet::new_empty(body.local_decls.len())
}
fn initialize_start_block(&self, body: &mir::Body<'tcx>, entry_set: &mut Self::Domain) {
// Function arguments are initialized to begin with.
for arg in body.args_iter() {
entry_set.insert(arg);
}
}
}
impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeInitializedLocals {
type Idx = Local;
fn statement_effect(
&self,
trans: &mut impl GenKill<Self::Idx>,
statement: &mir::Statement<'tcx>,
loc: Location,
) {
TransferFunction { trans }.visit_statement(statement, loc)
}
fn terminator_effect(
&self,
trans: &mut impl GenKill<Self::Idx>,
terminator: &mir::Terminator<'tcx>,
loc: Location,
) {
TransferFunction { trans }.visit_terminator(terminator, loc)
}
fn call_return_effect(
&self,
trans: &mut impl GenKill<Self::Idx>,
_block: BasicBlock,
return_places: CallReturnPlaces<'_, 'tcx>,
) {
return_places.for_each(|place| trans.gen(place.local));
}
/// See `Analysis::apply_yield_resume_effect`.
fn yield_resume_effect(
&self,
trans: &mut impl GenKill<Self::Idx>,
_resume_block: BasicBlock,
resume_place: mir::Place<'tcx>,
) {
trans.gen(resume_place.local)
}
}
struct TransferFunction<'a, T> {
trans: &'a mut T,
}
impl<T> Visitor<'_> for TransferFunction<'_, T>
where
T: GenKill<Local>,
{
// FIXME: Using `visit_local` here is a bug. For example, on `move _5.field` we mark `_5` as
// deinitialized, although clearly it is only partially deinitialized. This analysis is not
// actually used anywhere at the moment, so this is not critical, but this does need to be fixed
// before it starts being used again.
fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, NonUseContext};
match context {
// These are handled specially in `call_return_effect` and `yield_resume_effect`.
PlaceContext::MutatingUse(
MutatingUseContext::Call
| MutatingUseContext::AsmOutput
| MutatingUseContext::Yield,
) => {}
// If it's deinitialized, it's no longer init
PlaceContext::MutatingUse(MutatingUseContext::Deinit) => self.trans.kill(local),
// Otherwise, when a place is mutated, we must consider it possibly initialized.
PlaceContext::MutatingUse(_) => self.trans.gen(local),
// If the local is moved out of, or if it gets marked `StorageDead`, consider it no
// longer initialized.
PlaceContext::NonUse(NonUseContext::StorageDead)
| PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => self.trans.kill(local),
// All other uses do not affect this analysis.
PlaceContext::NonUse(
NonUseContext::StorageLive
| NonUseContext::AscribeUserTy
| NonUseContext::VarDebugInfo,
)
| PlaceContext::NonMutatingUse(
NonMutatingUseContext::Inspect
| NonMutatingUseContext::Copy
| NonMutatingUseContext::SharedBorrow
| NonMutatingUseContext::ShallowBorrow
| NonMutatingUseContext::UniqueBorrow
| NonMutatingUseContext::AddressOf
| NonMutatingUseContext::Projection,
) => {}
}
}
}

View file

@ -19,13 +19,11 @@ use crate::{drop_flag_effects, on_all_children_bits};
use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis}; use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis};
mod borrowed_locals; mod borrowed_locals;
mod init_locals;
mod liveness; mod liveness;
mod storage_liveness; mod storage_liveness;
pub use self::borrowed_locals::borrowed_locals; pub use self::borrowed_locals::borrowed_locals;
pub use self::borrowed_locals::MaybeBorrowedLocals; pub use self::borrowed_locals::MaybeBorrowedLocals;
pub use self::init_locals::MaybeInitializedLocals;
pub use self::liveness::MaybeLiveLocals; pub use self::liveness::MaybeLiveLocals;
pub use self::liveness::MaybeTransitiveLiveLocals; pub use self::liveness::MaybeTransitiveLiveLocals;
pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageLive}; pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageLive};

View file

@ -70,6 +70,8 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, borrowed: &BitS
for Location { block, statement_index } in patch { for Location { block, statement_index } in patch {
bbs[block].statements[statement_index].make_nop(); bbs[block].statements[statement_index].make_nop();
} }
crate::simplify::SimplifyLocals.run_pass(tcx, body)
} }
pub struct DeadStoreElimination; pub struct DeadStoreElimination;

View file

@ -110,15 +110,16 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
if let TerminatorKind::Call { ref args, .. } = terminator.kind { if let TerminatorKind::Call { ref args, .. } = terminator.kind {
for arg in args { for arg in args {
if let Operand::Move(_) = *arg { if let Operand::Move(place) = *arg {
// ArgumentChecker panics if a direct move of an argument from a caller to a let local = place.local;
// callee was detected. if place.is_indirect()
// || local == RETURN_PLACE
// If, in the future, MIR optimizations cause arguments to be moved directly || local.index() > self.mutable_args.domain_size()
// from callers to callees, change the panic to instead add the argument in {
// question to `mutating_uses`. continue;
ArgumentChecker::new(self.mutable_args.domain_size()) }
.visit_operand(arg, location)
self.mutable_args.insert(local.index() - 1);
} }
} }
}; };
@ -127,35 +128,6 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
} }
} }
/// A visitor that simply panics if a direct move of an argument from a caller to a callee was
/// detected.
struct ArgumentChecker {
/// The number of arguments to the calling function.
arg_count: usize,
}
impl ArgumentChecker {
/// Creates a new ArgumentChecker.
fn new(arg_count: usize) -> Self {
Self { arg_count }
}
}
impl<'tcx> Visitor<'tcx> for ArgumentChecker {
fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
// Check to make sure that, if this local is an argument, we didn't move directly from it.
if matches!(context, PlaceContext::NonMutatingUse(NonMutatingUseContext::Move))
&& local != RETURN_PLACE
&& local.index() <= self.arg_count
{
// If, in the future, MIR optimizations cause arguments to be moved directly from
// callers to callees, change this panic to instead add the argument in question to
// `mutating_uses`.
panic!("Detected a direct move from a caller's argument to a callee's argument!")
}
}
}
/// Returns true if values of a given type will never be passed indirectly, regardless of ABI. /// Returns true if values of a given type will never be passed indirectly, regardless of ABI.
fn type_will_always_be_passed_directly<'tcx>(ty: Ty<'tcx>) -> bool { fn type_will_always_be_passed_directly<'tcx>(ty: Ty<'tcx>) -> bool {
matches!( matches!(

File diff suppressed because it is too large Load diff

View file

@ -6,17 +6,20 @@
debug y => _2; // in scope 0 at $DIR/cycle.rs:+0:22: +0:27 debug y => _2; // in scope 0 at $DIR/cycle.rs:+0:22: +0:27
debug z => _3; // in scope 0 at $DIR/cycle.rs:+0:34: +0:39 debug z => _3; // in scope 0 at $DIR/cycle.rs:+0:34: +0:39
let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:46: +0:46 let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:46: +0:46
let mut _4: (); // in scope 0 at $DIR/cycle.rs:+0:1: +9:2 - let mut _4: (); // in scope 0 at $DIR/cycle.rs:+0:1: +9:2
let mut _5: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17 - let mut _5: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17
let _6: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17 - let _6: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17
let mut _7: i32; // in scope 0 at $DIR/cycle.rs:+5:13: +5:14 - let mut _7: i32; // in scope 0 at $DIR/cycle.rs:+5:13: +5:14
let mut _8: i32; // in scope 0 at $DIR/cycle.rs:+6:13: +6:14 - let mut _8: i32; // in scope 0 at $DIR/cycle.rs:+6:13: +6:14
let mut _9: i32; // in scope 0 at $DIR/cycle.rs:+7:13: +7:17 - let mut _9: i32; // in scope 0 at $DIR/cycle.rs:+7:13: +7:17
let mut _10: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6 - let mut _10: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
let _11: (); // in scope 0 at $DIR/cycle.rs:+3:5: +8:6 - let _11: (); // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
let mut _12: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6 - let mut _12: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
+ let mut _4: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17
+ let _5: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17
scope 1 { scope 1 {
debug temp => _6; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17 - debug temp => _6; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17
+ debug temp => _5; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17
} }
bb0: { bb0: {
@ -24,51 +27,57 @@
} }
bb1: { bb1: {
StorageLive(_5); // scope 0 at $DIR/cycle.rs:+3:11: +3:17 - StorageLive(_5); // scope 0 at $DIR/cycle.rs:+3:11: +3:17
_5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 - _5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
+ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+3:11: +3:17
+ _4 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
// mir::Constant // mir::Constant
// + span: $DIR/cycle.rs:12:11: 12:15 // + span: $DIR/cycle.rs:12:11: 12:15
// + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) }
} }
bb2: { bb2: {
switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 - switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
+ switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
} }
bb3: { bb3: {
StorageLive(_6); // scope 0 at $DIR/cycle.rs:+4:13: +4:17 - StorageLive(_6); // scope 0 at $DIR/cycle.rs:+4:13: +4:17
- _6 = _3; // scope 0 at $DIR/cycle.rs:+4:20: +4:21 - _6 = _3; // scope 0 at $DIR/cycle.rs:+4:20: +4:21
+ nop; // scope 0 at $DIR/cycle.rs:+4:20: +4:21 - StorageLive(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
StorageLive(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
- _7 = _2; // scope 1 at $DIR/cycle.rs:+5:13: +5:14 - _7 = _2; // scope 1 at $DIR/cycle.rs:+5:13: +5:14
- _3 = move _7; // scope 1 at $DIR/cycle.rs:+5:9: +5:14 - _3 = move _7; // scope 1 at $DIR/cycle.rs:+5:9: +5:14
+ nop; // scope 1 at $DIR/cycle.rs:+5:13: +5:14 - StorageDead(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
+ nop; // scope 1 at $DIR/cycle.rs:+5:9: +5:14 - StorageLive(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
StorageDead(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
StorageLive(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
- _8 = _1; // scope 1 at $DIR/cycle.rs:+6:13: +6:14 - _8 = _1; // scope 1 at $DIR/cycle.rs:+6:13: +6:14
- _2 = move _8; // scope 1 at $DIR/cycle.rs:+6:9: +6:14 - _2 = move _8; // scope 1 at $DIR/cycle.rs:+6:9: +6:14
+ nop; // scope 1 at $DIR/cycle.rs:+6:13: +6:14 - StorageDead(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
+ nop; // scope 1 at $DIR/cycle.rs:+6:9: +6:14 - StorageLive(_9); // scope 1 at $DIR/cycle.rs:+7:13: +7:17
StorageDead(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
StorageLive(_9); // scope 1 at $DIR/cycle.rs:+7:13: +7:17
- _9 = _6; // scope 1 at $DIR/cycle.rs:+7:13: +7:17 - _9 = _6; // scope 1 at $DIR/cycle.rs:+7:13: +7:17
- _1 = move _9; // scope 1 at $DIR/cycle.rs:+7:9: +7:17 - _1 = move _9; // scope 1 at $DIR/cycle.rs:+7:9: +7:17
- StorageDead(_9); // scope 1 at $DIR/cycle.rs:+7:16: +7:17
- _4 = const (); // scope 0 at $DIR/cycle.rs:+3:18: +8:6
- StorageDead(_6); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
+ StorageLive(_5); // scope 0 at $DIR/cycle.rs:+4:13: +4:17
+ nop; // scope 0 at $DIR/cycle.rs:+4:20: +4:21
+ nop; // scope 1 at $DIR/cycle.rs:+5:13: +5:14
+ nop; // scope 1 at $DIR/cycle.rs:+5:9: +5:14
+ nop; // scope 1 at $DIR/cycle.rs:+6:13: +6:14
+ nop; // scope 1 at $DIR/cycle.rs:+6:9: +6:14
+ nop; // scope 1 at $DIR/cycle.rs:+7:13: +7:17 + nop; // scope 1 at $DIR/cycle.rs:+7:13: +7:17
+ nop; // scope 1 at $DIR/cycle.rs:+7:9: +7:17 + nop; // scope 1 at $DIR/cycle.rs:+7:9: +7:17
StorageDead(_9); // scope 1 at $DIR/cycle.rs:+7:16: +7:17
- _4 = const (); // scope 0 at $DIR/cycle.rs:+3:18: +8:6
+ nop; // scope 0 at $DIR/cycle.rs:+3:18: +8:6 + nop; // scope 0 at $DIR/cycle.rs:+3:18: +8:6
StorageDead(_6); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
+ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6 goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6
} }
bb4: { bb4: {
StorageLive(_11); // scope 0 at $DIR/cycle.rs:+3:5: +8:6 - StorageLive(_11); // scope 0 at $DIR/cycle.rs:+3:5: +8:6
_0 = const (); // scope 0 at $DIR/cycle.rs:+3:5: +8:6 _0 = const (); // scope 0 at $DIR/cycle.rs:+3:5: +8:6
StorageDead(_11); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 - StorageDead(_11); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 - StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
+ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
return; // scope 0 at $DIR/cycle.rs:+9:2: +9:2 return; // scope 0 at $DIR/cycle.rs:+9:2: +9:2
} }
} }

View file

@ -1,29 +1,34 @@
- // MIR for `main` before DestinationPropagation - // MIR for `foo` before DestinationPropagation
+ // MIR for `main` after DestinationPropagation + // MIR for `foo` after DestinationPropagation
fn main() -> () { fn foo() -> i32 {
let mut _0: (); // return place in scope 0 at $DIR/branch.rs:+0:11: +0:11 let mut _0: i32; // return place in scope 0 at $DIR/branch.rs:+0:13: +0:16
let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10 let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10
let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22 let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22
let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14 let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10 - debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
+ debug x => _0; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10 let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10
scope 2 { scope 2 {
debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10 - debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
+ debug y => _0; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
} }
} }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10 - StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10
_1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18 - _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
+ nop; // scope 0 at $DIR/branch.rs:+1:9: +1:10
+ _0 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
// mir::Constant // mir::Constant
// + span: $DIR/branch.rs:13:13: 13:16 // + span: $DIR/branch.rs:13:13: 13:16
// + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
} }
bb1: { bb1: {
StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10 - StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10
+ nop; // scope 1 at $DIR/branch.rs:+3:9: +3:10
StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22 StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22
_3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22 _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22
// mir::Constant // mir::Constant
@ -36,7 +41,8 @@
} }
bb3: { bb3: {
nop; // scope 1 at $DIR/branch.rs:+4:9: +4:10 - _2 = _1; // scope 1 at $DIR/branch.rs:+4:9: +4:10
+ nop; // scope 1 at $DIR/branch.rs:+4:9: +4:10
goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6
} }
@ -50,16 +56,20 @@
bb5: { bb5: {
StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15 StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15
nop; // scope 1 at $DIR/branch.rs:+7:9: +7:10 - _2 = _1; // scope 1 at $DIR/branch.rs:+7:9: +7:10
+ nop; // scope 1 at $DIR/branch.rs:+7:9: +7:10
goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6
} }
bb6: { bb6: {
StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6 StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6
nop; // scope 0 at $DIR/branch.rs:+0:11: +9:2 - _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6
StorageDead(_2); // scope 1 at $DIR/branch.rs:+9:1: +9:2 - StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2
StorageDead(_1); // scope 0 at $DIR/branch.rs:+9:1: +9:2 - StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2
return; // scope 0 at $DIR/branch.rs:+9:2: +9:2 + nop; // scope 2 at $DIR/branch.rs:+10:5: +10:6
+ nop; // scope 1 at $DIR/branch.rs:+11:1: +11:2
+ nop; // scope 0 at $DIR/branch.rs:+11:1: +11:2
return; // scope 0 at $DIR/branch.rs:+11:2: +11:2
} }
} }

View file

@ -1,5 +1,5 @@
//! Tests that assignment in both branches of an `if` are eliminated. //! Tests that assignment in both branches of an `if` are eliminated.
// compile-flags: -Zunsound-mir-opts // unit-test: DestinationPropagation
fn val() -> i32 { fn val() -> i32 {
1 1
} }
@ -8,8 +8,8 @@ fn cond() -> bool {
true true
} }
// EMIT_MIR branch.main.DestinationPropagation.diff // EMIT_MIR branch.foo.DestinationPropagation.diff
fn main() { fn foo() -> i32 {
let x = val(); let x = val();
let y = if cond() { let y = if cond() {
@ -18,4 +18,10 @@ fn main() {
val(); val();
x x
}; };
y
}
fn main() {
foo();
} }

View file

@ -2,7 +2,7 @@
+ // MIR for `arg_src` after DestinationPropagation + // MIR for `arg_src` after DestinationPropagation
fn arg_src(_1: i32) -> i32 { fn arg_src(_1: i32) -> i32 {
debug x => const 123_i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:12: +0:17 debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:12: +0:17
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30 let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
scope 1 { scope 1 {
@ -15,7 +15,7 @@
- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 - _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
+ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 + _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
nop; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12 _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12
- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 - _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 - StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2
+ nop; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 + nop; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6

View file

@ -2,26 +2,30 @@
+ // MIR for `bar` after DestinationPropagation + // MIR for `bar` after DestinationPropagation
fn bar(_1: u8) -> () { fn bar(_1: u8) -> () {
debug x => const 5_u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19
let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 - StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 - _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
_2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 - _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
+ _2 = dummy(move _1) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
// mir::Constant // mir::Constant
// + span: $DIR/copy_propagation_arg.rs:16:5: 16:10 // + span: $DIR/copy_propagation_arg.rs:16:5: 16:10
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) } // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) }
} }
bb1: { bb1: {
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13 - StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2
} }
} }

View file

@ -1,18 +1,22 @@
- // MIR for `baz` before DestinationPropagation - // MIR for `baz` before DestinationPropagation
+ // MIR for `baz` after DestinationPropagation + // MIR for `baz` after DestinationPropagation
fn baz(_1: i32) -> () { fn baz(_1: i32) -> i32 {
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:20: +0:20 let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:23: +0:26
let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 - StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 - _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 - _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 - StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+0:20: +3:2 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
_0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2
} }
} }

View file

@ -8,10 +8,12 @@
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 - StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
_2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 - _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
+ _1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
// mir::Constant // mir::Constant
// + span: $DIR/copy_propagation_arg.rs:11:9: 11:14 // + span: $DIR/copy_propagation_arg.rs:11:9: 11:14
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) } // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) }
@ -19,9 +21,11 @@
bb1: { bb1: {
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17 - _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 - StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17
+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2
} }
} }

View file

@ -1,6 +1,6 @@
// Check that DestinationPropagation does not propagate an assignment to a function argument // Check that DestinationPropagation does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value) // (doing so can break usages of the original argument value)
// compile-flags: -Zunsound-mir-opts // unit-test: DestinationPropagation
fn dummy(x: u8) -> u8 { fn dummy(x: u8) -> u8 {
x x
} }
@ -18,9 +18,10 @@ fn bar(mut x: u8) {
} }
// EMIT_MIR copy_propagation_arg.baz.DestinationPropagation.diff // EMIT_MIR copy_propagation_arg.baz.DestinationPropagation.diff
fn baz(mut x: i32) { fn baz(mut x: i32) -> i32 {
// self-assignment to a function argument should be eliminated // self-assignment to a function argument should be eliminated
x = x; x = x;
x
} }
// EMIT_MIR copy_propagation_arg.arg_src.DestinationPropagation.diff // EMIT_MIR copy_propagation_arg.arg_src.DestinationPropagation.diff

View file

@ -8,45 +8,69 @@
let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12 let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12
let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11 let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11
scope 1 { scope 1 {
debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14 - debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
+ debug x => _6; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10 let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10
scope 2 { scope 2 {
debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10 - debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
+ debug y => _6; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10 let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10
scope 3 { scope 3 {
debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 - debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
scope 4 (inlined std::mem::drop::<i32>) { // at $DIR/cycle.rs:14:5: 14:12 + debug z => _6; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
debug _x => _6; // in scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
}
} }
} }
} }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14 - StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14
_1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 - _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
+ nop; // scope 0 at $DIR/cycle.rs:+1:9: +1:14
+ _6 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
// mir::Constant // mir::Constant
// + span: $DIR/cycle.rs:9:17: 9:20 // + span: $DIR/cycle.rs:9:17: 9:20
// + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
} }
bb1: { bb1: {
StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10 - StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10
nop; // scope 1 at $DIR/cycle.rs:+2:13: +2:14 - _2 = _1; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10 - StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10
nop; // scope 2 at $DIR/cycle.rs:+3:13: +3:14 - _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 - StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 - _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
nop; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 - _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 - StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
+ nop; // scope 1 at $DIR/cycle.rs:+2:9: +2:10
+ nop; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
+ nop; // scope 2 at $DIR/cycle.rs:+3:9: +3:10
+ nop; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
+ nop; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12 StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12
StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11 - StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11
nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 - _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12 + nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
_5 = std::mem::drop::<i32>(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12
// mir::Constant
// + span: $DIR/cycle.rs:14:5: 14:9
// + literal: Const { ty: fn(i32) {std::mem::drop::<i32>}, val: Value(<ZST>) }
}
bb2: {
- StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12
+ nop; // scope 3 at $DIR/cycle.rs:+6:11: +6:12
StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13 StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13
StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2 _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2
StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2 - StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2
StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2 - StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2
+ nop; // scope 2 at $DIR/cycle.rs:+7:1: +7:2
+ nop; // scope 1 at $DIR/cycle.rs:+7:1: +7:2
+ nop; // scope 0 at $DIR/cycle.rs:+7:1: +7:2
return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2 return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2
} }
} }

View file

@ -1,5 +1,5 @@
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code. //! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
// compile-flags: -Zunsound-mir-opts // unit-test: DestinationPropagation
fn val() -> i32 { fn val() -> i32 {
1 1
} }

View file

@ -0,0 +1,34 @@
// MIR for `f` after DestinationPropagation
fn f(_1: usize) -> usize {
debug a => _1; // in scope 0 at $DIR/dead_stores_79191.rs:+0:6: +0:11
let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_79191.rs:+0:23: +0:28
let _2: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10
let mut _3: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+3:9: +3:10
let mut _4: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+4:8: +4:9
scope 1 {
debug b => _3; // in scope 1 at $DIR/dead_stores_79191.rs:+1:9: +1:10
}
bb0: {
nop; // scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10
_3 = _1; // scope 0 at $DIR/dead_stores_79191.rs:+1:13: +1:14
_1 = const 5_usize; // scope 1 at $DIR/dead_stores_79191.rs:+2:5: +2:10
nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10
nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10
_1 = move _3; // scope 1 at $DIR/dead_stores_79191.rs:+3:5: +3:10
nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10
nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9
nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9
_0 = id::<usize>(move _1) -> bb1; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10
// mir::Constant
// + span: $DIR/dead_stores_79191.rs:12:5: 12:7
// + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
}
bb1: {
nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:9: +4:10
nop; // scope 0 at $DIR/dead_stores_79191.rs:+5:1: +5:2
return; // scope 0 at $DIR/dead_stores_79191.rs:+5:2: +5:2
}
}

View file

@ -0,0 +1,17 @@
// unit-test: DestinationPropagation
fn id<T>(x: T) -> T {
x
}
// EMIT_MIR dead_stores_79191.f.DestinationPropagation.after.mir
fn f(mut a: usize) -> usize {
let b = a;
a = 5;
a = b;
id(a)
}
fn main() {
f(0);
}

View file

@ -0,0 +1,34 @@
// MIR for `f` after DestinationPropagation
fn f(_1: usize) -> usize {
debug a => _1; // in scope 0 at $DIR/dead_stores_better.rs:+0:10: +0:15
let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_better.rs:+0:27: +0:32
let _2: usize; // in scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10
let mut _3: usize; // in scope 0 at $DIR/dead_stores_better.rs:+3:9: +3:10
let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9
scope 1 {
debug b => _1; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10
}
bb0: {
nop; // scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10
nop; // scope 0 at $DIR/dead_stores_better.rs:+1:13: +1:14
nop; // scope 1 at $DIR/dead_stores_better.rs:+2:5: +2:10
nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
nop; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10
nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
_0 = id::<usize>(move _1) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10
// mir::Constant
// + span: $DIR/dead_stores_better.rs:16:5: 16:7
// + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
}
bb1: {
nop; // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10
nop; // scope 0 at $DIR/dead_stores_better.rs:+5:1: +5:2
return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2
}
}

View file

@ -0,0 +1,21 @@
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
// unit-test: DestinationPropagation
// compile-flags: -Zmir-enable-passes=+DeadStoreElimination
fn id<T>(x: T) -> T {
x
}
// EMIT_MIR dead_stores_better.f.DestinationPropagation.after.mir
pub fn f(mut a: usize) -> usize {
let b = a;
a = 5;
a = b;
id(a)
}
fn main() {
f(0);
}

View file

@ -17,18 +17,22 @@
StorageLive(_2); // scope 0 at $DIR/simple.rs:+1:9: +1:16 StorageLive(_2); // scope 0 at $DIR/simple.rs:+1:9: +1:16
_2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:+1:19: +1:28 _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:+1:19: +1:28
StorageLive(_3); // scope 1 at $DIR/simple.rs:+2:5: +2:19 StorageLive(_3); // scope 1 at $DIR/simple.rs:+2:5: +2:19
StorageLive(_4); // scope 1 at $DIR/simple.rs:+2:5: +2:9 - StorageLive(_4); // scope 1 at $DIR/simple.rs:+2:5: +2:9
_4 = _1; // scope 1 at $DIR/simple.rs:+2:5: +2:9 - _4 = _1; // scope 1 at $DIR/simple.rs:+2:5: +2:9
+ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9
+ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9
StorageLive(_5); // scope 1 at $DIR/simple.rs:+2:10: +2:18 StorageLive(_5); // scope 1 at $DIR/simple.rs:+2:10: +2:18
StorageLive(_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18 StorageLive(_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18
_6 = &mut _2; // scope 1 at $DIR/simple.rs:+2:10: +2:18 _6 = &mut _2; // scope 1 at $DIR/simple.rs:+2:10: +2:18
_5 = &mut (*_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18 _5 = &mut (*_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18
_3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19 - _3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19
+ _3 = move _1(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19
} }
bb1: { bb1: {
StorageDead(_5); // scope 1 at $DIR/simple.rs:+2:18: +2:19 StorageDead(_5); // scope 1 at $DIR/simple.rs:+2:18: +2:19
StorageDead(_4); // scope 1 at $DIR/simple.rs:+2:18: +2:19 - StorageDead(_4); // scope 1 at $DIR/simple.rs:+2:18: +2:19
+ nop; // scope 1 at $DIR/simple.rs:+2:18: +2:19
StorageDead(_6); // scope 1 at $DIR/simple.rs:+2:19: +2:20 StorageDead(_6); // scope 1 at $DIR/simple.rs:+2:19: +2:20
StorageDead(_3); // scope 1 at $DIR/simple.rs:+2:19: +2:20 StorageDead(_3); // scope 1 at $DIR/simple.rs:+2:19: +2:20
_0 = _2; // scope 1 at $DIR/simple.rs:+3:5: +3:8 _0 = _2; // scope 1 at $DIR/simple.rs:+3:5: +3:8

View file

@ -1,5 +1,5 @@
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
// compile-flags: -Zunsound-mir-opts // unit-test: DestinationPropagation
// EMIT_MIR simple.nrvo.DestinationPropagation.diff // EMIT_MIR simple.nrvo.DestinationPropagation.diff
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
let mut buf = [0; 1024]; let mut buf = [0; 1024];

View file

@ -5,14 +5,13 @@
let mut _0: (); // return place in scope 0 at $DIR/union.rs:+0:11: +0:11 let mut _0: (); // return place in scope 0 at $DIR/union.rs:+0:11: +0:11
let _1: main::Un; // in scope 0 at $DIR/union.rs:+5:9: +5:11 let _1: main::Un; // in scope 0 at $DIR/union.rs:+5:9: +5:11
let mut _2: u32; // in scope 0 at $DIR/union.rs:+5:23: +5:28 let mut _2: u32; // in scope 0 at $DIR/union.rs:+5:23: +5:28
let _3: (); // in scope 0 at $DIR/union.rs:+7:5: +7:27 let mut _3: u32; // in scope 0 at $DIR/union.rs:+7:10: +7:26
let mut _4: u32; // in scope 0 at $DIR/union.rs:+7:10: +7:26
scope 1 { scope 1 {
debug un => _1; // in scope 1 at $DIR/union.rs:+5:9: +5:11 debug un => _1; // in scope 1 at $DIR/union.rs:+5:9: +5:11
scope 2 { scope 2 {
} }
scope 3 (inlined std::mem::drop::<u32>) { // at $DIR/union.rs:15:5: 15:27 scope 3 (inlined std::mem::drop::<u32>) { // at $DIR/union.rs:15:5: 15:27
debug _x => _4; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL debug _x => _3; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
} }
} }
@ -29,11 +28,9 @@
nop; // scope 0 at $DIR/union.rs:+5:14: +5:30 nop; // scope 0 at $DIR/union.rs:+5:14: +5:30
nop; // scope 0 at $DIR/union.rs:+5:14: +5:30 nop; // scope 0 at $DIR/union.rs:+5:14: +5:30
StorageDead(_2); // scope 0 at $DIR/union.rs:+5:29: +5:30 StorageDead(_2); // scope 0 at $DIR/union.rs:+5:29: +5:30
StorageLive(_3); // scope 1 at $DIR/union.rs:+7:5: +7:27 StorageLive(_3); // scope 1 at $DIR/union.rs:+7:10: +7:26
StorageLive(_4); // scope 1 at $DIR/union.rs:+7:10: +7:26
nop; // scope 2 at $DIR/union.rs:+7:19: +7:24 nop; // scope 2 at $DIR/union.rs:+7:19: +7:24
StorageDead(_4); // scope 1 at $DIR/union.rs:+7:26: +7:27 StorageDead(_3); // scope 1 at $DIR/union.rs:+7:26: +7:27
StorageDead(_3); // scope 1 at $DIR/union.rs:+7:27: +7:28
StorageDead(_1); // scope 0 at $DIR/union.rs:+8:1: +8:2 StorageDead(_1); // scope 0 at $DIR/union.rs:+8:1: +8:2
return; // scope 0 at $DIR/union.rs:+8:2: +8:2 return; // scope 0 at $DIR/union.rs:+8:2: +8:2
} }

View file

@ -12,10 +12,8 @@
+ scope 2 (inlined try_execute_query::<<Q as Query>::C>) { // at $DIR/dyn_trait.rs:34:5: 34:25 + scope 2 (inlined try_execute_query::<<Q as Query>::C>) { // at $DIR/dyn_trait.rs:34:5: 34:25
+ debug c => _4; // in scope 2 at $DIR/dyn_trait.rs:26:36: 26:37 + debug c => _4; // in scope 2 at $DIR/dyn_trait.rs:26:36: 26:37
+ let mut _5: &dyn Cache<V = <Q as Query>::V>; // in scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 + let mut _5: &dyn Cache<V = <Q as Query>::V>; // in scope 2 at $DIR/dyn_trait.rs:27:14: 27:15
+ let mut _6: &<Q as Query>::C; // in scope 2 at $DIR/dyn_trait.rs:27:14: 27:15
+ scope 3 (inlined mk_cycle::<<Q as Query>::V>) { // at $DIR/dyn_trait.rs:27:5: 27:16 + scope 3 (inlined mk_cycle::<<Q as Query>::V>) { // at $DIR/dyn_trait.rs:27:5: 27:16
+ debug c => _5; // in scope 3 at $DIR/dyn_trait.rs:20:27: 20:28 + debug c => _5; // in scope 3 at $DIR/dyn_trait.rs:20:27: 20:28
+ let mut _7: &dyn Cache<V = <Q as Query>::V>; // in scope 3 at $DIR/dyn_trait.rs:21:5: 21:22
+ } + }
+ } + }
} }
@ -37,13 +35,8 @@
_4 = &(*_2); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24 _4 = &(*_2); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> bb2; // scope 1 at $DIR/dyn_trait.rs:+2:5: +2:25 - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> bb2; // scope 1 at $DIR/dyn_trait.rs:+2:5: +2:25
+ StorageLive(_5); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 + StorageLive(_5); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15
+ StorageLive(_6); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 + _5 = move _4 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15
+ _6 = _4; // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15 + _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> bb2; // scope 3 at $DIR/dyn_trait.rs:21:5: 21:22
+ _5 = move _6 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15
+ StorageDead(_6); // scope 2 at $DIR/dyn_trait.rs:27:14: 27:15
+ StorageLive(_7); // scope 3 at $DIR/dyn_trait.rs:21:5: 21:22
+ _7 = _5; // scope 3 at $DIR/dyn_trait.rs:21:5: 21:22
+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _7) -> bb2; // scope 3 at $DIR/dyn_trait.rs:21:5: 21:22
// mir::Constant // mir::Constant
- // + span: $DIR/dyn_trait.rs:34:5: 34:22 - // + span: $DIR/dyn_trait.rs:34:5: 34:22
- // + literal: Const { ty: for<'a> fn(&'a <Q as Query>::C) {try_execute_query::<<Q as Query>::C>}, val: Value(<ZST>) } - // + literal: Const { ty: for<'a> fn(&'a <Q as Query>::C) {try_execute_query::<<Q as Query>::C>}, val: Value(<ZST>) }
@ -52,7 +45,6 @@
} }
bb2: { bb2: {
+ StorageDead(_7); // scope 3 at $DIR/dyn_trait.rs:21:21: 21:22
+ StorageDead(_5); // scope 2 at $DIR/dyn_trait.rs:27:15: 27:16 + StorageDead(_5); // scope 2 at $DIR/dyn_trait.rs:27:15: 27:16
StorageDead(_4); // scope 1 at $DIR/dyn_trait.rs:+2:24: +2:25 StorageDead(_4); // scope 1 at $DIR/dyn_trait.rs:+2:24: +2:25
StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+3:1: +3:2 StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+3:1: +3:2

View file

@ -8,7 +8,6 @@
let mut _3: &C; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 let mut _3: &C; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
+ scope 1 (inlined mk_cycle::<<C as Cache>::V>) { // at $DIR/dyn_trait.rs:27:5: 27:16 + scope 1 (inlined mk_cycle::<<C as Cache>::V>) { // at $DIR/dyn_trait.rs:27:5: 27:16
+ debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:20:27: 20:28 + debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:20:27: 20:28
+ let mut _4: &dyn Cache<V = <C as Cache>::V>; // in scope 1 at $DIR/dyn_trait.rs:21:5: 21:22
+ } + }
bb0: { bb0: {
@ -18,9 +17,7 @@
_2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize)); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize)); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:16 - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:16
+ StorageLive(_4); // scope 1 at $DIR/dyn_trait.rs:21:5: 21:22 + _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _2) -> bb1; // scope 1 at $DIR/dyn_trait.rs:21:5: 21:22
+ _4 = _2; // scope 1 at $DIR/dyn_trait.rs:21:5: 21:22
+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _4) -> bb1; // scope 1 at $DIR/dyn_trait.rs:21:5: 21:22
// mir::Constant // mir::Constant
- // + span: $DIR/dyn_trait.rs:27:5: 27:13 - // + span: $DIR/dyn_trait.rs:27:5: 27:13
- // + literal: Const { ty: for<'a> fn(&'a (dyn Cache<V = <C as Cache>::V> + 'a)) {mk_cycle::<<C as Cache>::V>}, val: Value(<ZST>) } - // + literal: Const { ty: for<'a> fn(&'a (dyn Cache<V = <C as Cache>::V> + 'a)) {mk_cycle::<<C as Cache>::V>}, val: Value(<ZST>) }
@ -29,7 +26,6 @@
} }
bb1: { bb1: {
+ StorageDead(_4); // scope 1 at $DIR/dyn_trait.rs:21:21: 21:22
StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+1:15: +1:16 StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+1:15: +1:16
return; // scope 0 at $DIR/dyn_trait.rs:+2:2: +2:2 return; // scope 0 at $DIR/dyn_trait.rs:+2:2: +2:2
} }

View file

@ -11,8 +11,6 @@ fn bar() -> bool {
scope 2 (inlined foo) { // at $DIR/inline_any_operand.rs:12:5: 12:13 scope 2 (inlined foo) { // at $DIR/inline_any_operand.rs:12:5: 12:13
debug x => _3; // in scope 2 at $DIR/inline_any_operand.rs:16:8: 16:9 debug x => _3; // in scope 2 at $DIR/inline_any_operand.rs:16:8: 16:9
debug y => _4; // in scope 2 at $DIR/inline_any_operand.rs:16:16: 16:17 debug y => _4; // in scope 2 at $DIR/inline_any_operand.rs:16:16: 16:17
let mut _5: i32; // in scope 2 at $DIR/inline_any_operand.rs:17:5: 17:6
let mut _6: i32; // in scope 2 at $DIR/inline_any_operand.rs:17:10: 17:11
} }
} }
@ -28,13 +26,7 @@ fn bar() -> bool {
_3 = const 1_i32; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13 _3 = const 1_i32; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
StorageLive(_4); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13 StorageLive(_4); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
_4 = const -1_i32; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13 _4 = const -1_i32; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
StorageLive(_5); // scope 2 at $DIR/inline_any_operand.rs:17:5: 17:6 _0 = Eq(move _3, move _4); // scope 2 at $DIR/inline_any_operand.rs:17:5: 17:11
_5 = _3; // scope 2 at $DIR/inline_any_operand.rs:17:5: 17:6
StorageLive(_6); // scope 2 at $DIR/inline_any_operand.rs:17:10: 17:11
_6 = _4; // scope 2 at $DIR/inline_any_operand.rs:17:10: 17:11
_0 = Eq(move _5, move _6); // scope 2 at $DIR/inline_any_operand.rs:17:5: 17:11
StorageDead(_6); // scope 2 at $DIR/inline_any_operand.rs:17:10: 17:11
StorageDead(_5); // scope 2 at $DIR/inline_any_operand.rs:17:10: 17:11
StorageDead(_4); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13 StorageDead(_4); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
StorageDead(_3); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13 StorageDead(_3); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
StorageDead(_2); // scope 1 at $DIR/inline_any_operand.rs:+2:12: +2:13 StorageDead(_2); // scope 1 at $DIR/inline_any_operand.rs:+2:12: +2:13

View file

@ -16,9 +16,8 @@ fn foo(_1: T, _2: &i32) -> i32 {
scope 2 (inlined foo::<T>::{closure#0}) { // at $DIR/inline_closure_borrows_arg.rs:16:5: 16:12 scope 2 (inlined foo::<T>::{closure#0}) { // at $DIR/inline_closure_borrows_arg.rs:16:5: 16:12
debug r => _8; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+1:14: +1:15 debug r => _8; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+1:14: +1:15
debug _s => _9; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+1:23: +1:25 debug _s => _9; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+1:23: +1:25
let _10: &i32; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+2:13: +2:21
scope 3 { scope 3 {
debug variable => _10; // in scope 3 at $DIR/inline_closure_borrows_arg.rs:+2:13: +2:21 debug variable => _8; // in scope 3 at $DIR/inline_closure_borrows_arg.rs:+2:13: +2:21
} }
} }
} }
@ -40,10 +39,7 @@ fn foo(_1: T, _2: &i32) -> i32 {
_8 = move (_5.0: &i32); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12 _8 = move (_5.0: &i32); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
StorageLive(_9); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12 StorageLive(_9); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
_9 = move (_5.1: &i32); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12 _9 = move (_5.1: &i32); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
StorageLive(_10); // scope 2 at $DIR/inline_closure_borrows_arg.rs:+2:13: +2:21 _0 = (*_8); // scope 3 at $DIR/inline_closure_borrows_arg.rs:+3:9: +3:18
_10 = _8; // scope 2 at $DIR/inline_closure_borrows_arg.rs:+2:24: +2:27
_0 = (*_10); // scope 3 at $DIR/inline_closure_borrows_arg.rs:+3:9: +3:18
StorageDead(_10); // scope 2 at $DIR/inline_closure_borrows_arg.rs:+4:5: +4:6
StorageDead(_9); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12 StorageDead(_9); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
StorageDead(_8); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12 StorageDead(_8); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
StorageDead(_7); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:11: +5:12 StorageDead(_7); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:11: +5:12

View file

@ -8,11 +8,10 @@
+ scope 1 (inlined call::<fn() {f}>) { // at $DIR/inline_cycle.rs:49:5: 49:12 + scope 1 (inlined call::<fn() {f}>) { // at $DIR/inline_cycle.rs:49:5: 49:12
+ debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:53:22: 53:23 + debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:53:22: 53:23
+ let _3: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 + let _3: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8
+ let mut _4: fn() {f}; // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:6 + let mut _4: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8
+ let mut _5: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8
+ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:54:5: 54:8 + scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:54:5: 54:8
+ scope 3 (inlined f) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL + scope 3 (inlined f) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL
+ let _6: (); // in scope 3 at $DIR/inline_cycle.rs:59:5: 59:12 + let _5: (); // in scope 3 at $DIR/inline_cycle.rs:59:5: 59:12
+ } + }
+ } + }
+ } + }
@ -27,11 +26,9 @@
+ // + span: $DIR/inline_cycle.rs:49:10: 49:11 + // + span: $DIR/inline_cycle.rs:49:10: 49:11
+ // + literal: Const { ty: fn() {f}, val: Value(<ZST>) } + // + literal: Const { ty: fn() {f}, val: Value(<ZST>) }
+ StorageLive(_3); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 + StorageLive(_3); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8
+ StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:6 + StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8
+ _4 = move _2; // scope 1 at $DIR/inline_cycle.rs:54:5: 54:6 + StorageLive(_5); // scope 3 at $DIR/inline_cycle.rs:59:5: 59:12
+ StorageLive(_5); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 + _5 = call::<fn() {f}>(f) -> bb1; // scope 3 at $DIR/inline_cycle.rs:59:5: 59:12
+ StorageLive(_6); // scope 3 at $DIR/inline_cycle.rs:59:5: 59:12
+ _6 = call::<fn() {f}>(f) -> bb1; // scope 3 at $DIR/inline_cycle.rs:59:5: 59:12
+ // mir::Constant + // mir::Constant
+ // + span: $DIR/inline_cycle.rs:59:5: 59:9 + // + span: $DIR/inline_cycle.rs:59:5: 59:9
// + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(<ZST>) } // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(<ZST>) }
@ -42,8 +39,7 @@
} }
bb1: { bb1: {
+ StorageDead(_6); // scope 3 at $DIR/inline_cycle.rs:59:12: 59:13 + StorageDead(_5); // scope 3 at $DIR/inline_cycle.rs:59:12: 59:13
+ StorageDead(_5); // scope 1 at $DIR/inline_cycle.rs:54:7: 54:8
+ StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:54:7: 54:8 + StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:54:7: 54:8
+ StorageDead(_3); // scope 1 at $DIR/inline_cycle.rs:54:8: 54:9 + StorageDead(_3); // scope 1 at $DIR/inline_cycle.rs:54:8: 54:9
+ StorageDead(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 + StorageDead(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12

View file

@ -10,15 +10,14 @@
+ let _3: !; // in scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 + let _3: !; // in scope 1 at $DIR/inline_diverging.rs:27:9: 27:10
+ let mut _4: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + let mut _4: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14
+ let mut _5: (); // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 + let mut _5: (); // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:16
+ let mut _7: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14 + let mut _6: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14
+ let mut _8: (); // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:16 + let mut _7: (); // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:16
+ let mut _9: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7 + let mut _8: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7
+ let mut _10: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10 + let mut _9: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10
+ scope 2 { + scope 2 {
+ debug a => _3; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10 + debug a => _3; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10
+ let _6: !; // in scope 2 at $DIR/inline_diverging.rs:28:9: 28:10
+ scope 3 { + scope 3 {
+ debug b => _6; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 + debug b => _9; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10
+ } + }
+ scope 6 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:28:13: 28:16 + scope 6 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:28:13: 28:16
+ scope 7 (inlined sleep) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL + scope 7 (inlined sleep) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL
@ -42,6 +41,7 @@
- // mir::Constant - // mir::Constant
// + span: $DIR/inline_diverging.rs:22:16: 22:21 // + span: $DIR/inline_diverging.rs:22:16: 22:21
// + literal: Const { ty: fn() -> ! {sleep}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> ! {sleep}, val: Value(<ZST>) }
+ StorageLive(_9); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
+ StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 + StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:9: 27:10
+ StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14
+ _4 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + _4 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14

View file

@ -24,15 +24,12 @@
+ } + }
+ } + }
+ scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:14: 9:46 + scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:14: 9:46
+ debug a => _11; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7 + debug a => _7; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
+ let mut _8: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39 + let mut _8: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39
+ let mut _9: bool; // in scope 6 at $DIR/inline_generator.rs:15:20: 15:21 + let mut _9: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _10: bool; // in scope 6 at $DIR/inline_generator.rs:15:9: 15:9 + let mut _10: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let _11: bool; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7 + let mut _11: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _12: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + let mut _12: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _13: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _14: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ let mut _15: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ } + }
bb0: { bb0: {
@ -73,17 +70,13 @@
- // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(<ZST>) } - // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(<ZST>) }
+ StorageLive(_7); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 + StorageLive(_7); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
+ _7 = const false; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 + _7 = const false; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
+ StorageLive(_10); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 + _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ StorageLive(_11); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 + _9 = discriminant((*_10)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ _13 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + switchInt(move _9) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ _12 = discriminant((*_13)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
} }
- bb3: { - bb3: {
+ bb1: { + bb1: {
+ StorageDead(_11); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
+ StorageDead(_10); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
+ StorageDead(_7); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 + StorageDead(_7); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
StorageDead(_2); // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46 StorageDead(_2); // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46
StorageDead(_4); // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47 StorageDead(_4); // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47
@ -98,11 +91,8 @@
+ } + }
+ +
+ bb3: { + bb3: {
+ _11 = move _7; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 + StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
+ StorageLive(_9); // scope 6 at $DIR/inline_generator.rs:15:20: 15:21 + switchInt(move _7) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
+ _9 = _11; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
+ switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
+ } + }
+ +
+ bb4: { + bb4: {
@ -116,24 +106,22 @@
+ } + }
+ +
+ bb6: { + bb6: {
+ StorageDead(_9); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
+ Deinit(_1); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + Deinit(_1); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ discriminant(_1) = 0; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + discriminant(_1) = 0; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ _14 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + _11 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ discriminant((*_14)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + discriminant((*_11)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39 + goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39
+ } + }
+ +
+ bb7: { + bb7: {
+ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ _10 = move _7; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
+ StorageDead(_8); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39 + StorageDead(_8); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
+ Deinit(_1); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + Deinit(_1); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + ((_1 as Complete).0: bool) = move _7; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ discriminant(_1) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + discriminant(_1) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ _15 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + _12 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ discriminant((*_15)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + discriminant((*_12)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41 + goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41
+ } + }
+ +

View file

@ -7,7 +7,6 @@ fn test2(_1: &dyn X) -> bool {
let mut _3: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 let mut _3: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
scope 1 (inlined test) { // at $DIR/inline_trait_method_2.rs:5:5: 5:12 scope 1 (inlined test) { // at $DIR/inline_trait_method_2.rs:5:5: 5:12
debug x => _2; // in scope 1 at $DIR/inline_trait_method_2.rs:9:9: 9:10 debug x => _2; // in scope 1 at $DIR/inline_trait_method_2.rs:9:9: 9:10
let mut _4: &dyn X; // in scope 1 at $DIR/inline_trait_method_2.rs:10:5: 10:10
} }
bb0: { bb0: {
@ -16,16 +15,13 @@ fn test2(_1: &dyn X) -> bool {
_3 = &(*_1); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 _3 = &(*_1); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
_2 = move _3 as &dyn X (Pointer(Unsize)); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 _2 = move _3 as &dyn X (Pointer(Unsize)); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
StorageDead(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 StorageDead(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
StorageLive(_4); // scope 1 at $DIR/inline_trait_method_2.rs:10:5: 10:10 _0 = <dyn X as X>::y(move _2) -> bb1; // scope 1 at $DIR/inline_trait_method_2.rs:10:5: 10:10
_4 = _2; // scope 1 at $DIR/inline_trait_method_2.rs:10:5: 10:10
_0 = <dyn X as X>::y(move _4) -> bb1; // scope 1 at $DIR/inline_trait_method_2.rs:10:5: 10:10
// mir::Constant // mir::Constant
// + span: $DIR/inline_trait_method_2.rs:10:7: 10:8 // + span: $DIR/inline_trait_method_2.rs:10:7: 10:8
// + literal: Const { ty: for<'a> fn(&'a dyn X) -> bool {<dyn X as X>::y}, val: Value(<ZST>) } // + literal: Const { ty: for<'a> fn(&'a dyn X) -> bool {<dyn X as X>::y}, val: Value(<ZST>) }
} }
bb1: { bb1: {
StorageDead(_4); // scope 1 at $DIR/inline_trait_method_2.rs:10:9: 10:10
StorageDead(_2); // scope 0 at $DIR/inline_trait_method_2.rs:+1:11: +1:12 StorageDead(_2); // scope 0 at $DIR/inline_trait_method_2.rs:+1:11: +1:12
return; // scope 0 at $DIR/inline_trait_method_2.rs:+2:2: +2:2 return; // scope 0 at $DIR/inline_trait_method_2.rs:+2:2: +2:2
} }

View file

@ -18,8 +18,7 @@
debug x => _5; // in scope 1 at $DIR/issue_101973.rs:5:13: 5:14 debug x => _5; // in scope 1 at $DIR/issue_101973.rs:5:13: 5:14
let mut _12: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:27 let mut _12: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:27
let mut _13: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20 let mut _13: u32; // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20
let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:7:13: 7:14 let mut _14: (u32, bool); // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20
let mut _15: (u32, bool); // in scope 1 at $DIR/issue_101973.rs:7:12: 7:20
scope 2 { scope 2 {
debug out => _4; // in scope 2 at $DIR/issue_101973.rs:6:9: 6:16 debug out => _4; // in scope 2 at $DIR/issue_101973.rs:6:9: 6:16
} }
@ -27,8 +26,8 @@
scope 3 (inlined core::num::<impl u32>::rotate_right) { // at $DIR/issue_101973.rs:14:5: 14:58 scope 3 (inlined core::num::<impl u32>::rotate_right) { // at $DIR/issue_101973.rs:14:5: 14:58
debug self => _4; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug self => _4; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
debug n => _6; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug n => _6; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
let mut _15: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
let mut _16: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _16: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
let mut _17: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
} }
bb0: { bb0: {
@ -39,10 +38,8 @@
_5 = _1; // scope 0 at $DIR/issue_101973.rs:+1:10: +1:16 _5 = _1; // scope 0 at $DIR/issue_101973.rs:+1:10: +1:16
StorageLive(_12); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27 StorageLive(_12); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27
StorageLive(_13); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20 StorageLive(_13); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:7:13: 7:14 _14 = CheckedShr(_5, const 0_i32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
_14 = _5; // scope 2 at $DIR/issue_101973.rs:7:13: 7:14 assert(!move (_14.1: bool), "attempt to shift right by `{}`, which would overflow", const 0_i32) -> bb3; // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
_15 = CheckedShr(_14, const 0_i32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
assert(!move (_15.1: bool), "attempt to shift right by `{}`, which would overflow", const 0_i32) -> bb3; // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
} }
bb1: { bb1: {
@ -57,19 +54,18 @@
bb2: { bb2: {
_6 = move (_11.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 _6 = move (_11.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57 StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57
StorageLive(_15); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
_15 = _4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageLive(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL StorageLive(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
_16 = _4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL _16 = _6; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageLive(_17); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL _3 = rotate_right::<u32>(move _15, move _16) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
_17 = _6; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
_3 = rotate_right::<u32>(move _16, move _17) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
// + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::<u32>}, val: Value(<ZST>) } // + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::<u32>}, val: Value(<ZST>) }
} }
bb3: { bb3: {
_13 = move (_15.0: u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20 _13 = move (_14.0: u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:20
StorageDead(_14); // scope 2 at $DIR/issue_101973.rs:7:19: 7:20
_12 = BitAnd(move _13, const 255_u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27 _12 = BitAnd(move _13, const 255_u32); // scope 2 at $DIR/issue_101973.rs:7:12: 7:27
StorageDead(_13); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27 StorageDead(_13); // scope 2 at $DIR/issue_101973.rs:7:26: 7:27
_4 = BitOr(const 0_u32, move _12); // scope 2 at $DIR/issue_101973.rs:7:5: 7:27 _4 = BitOr(const 0_u32, move _12); // scope 2 at $DIR/issue_101973.rs:7:5: 7:27
@ -85,8 +81,8 @@
} }
bb4: { bb4: {
StorageDead(_17); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageDead(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL StorageDead(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageDead(_15); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58 StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58 StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
_2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 _2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65

View file

@ -3,64 +3,54 @@
fn num_to_digit(_1: char) -> u32 { fn num_to_digit(_1: char) -> u32 {
debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24 debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24
let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38 let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38
let mut _2: char; // in scope 0 at $DIR/issue_59352.rs:+2:8: +2:11 let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
let mut _3: std::option::Option<u32>; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 let mut _3: u32; // in scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
let mut _4: char; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:29 let mut _9: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _5: u32; // in scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
let mut _12: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 1 (inlined char::methods::<impl char>::is_digit) { // at $DIR/issue_59352.rs:14:8: 14:23 scope 1 (inlined char::methods::<impl char>::is_digit) { // at $DIR/issue_59352.rs:14:8: 14:23
debug self => _2; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
debug radix => _5; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL debug radix => _3; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
let mut _6: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL let mut _4: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
let _7: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL let _5: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
let mut _8: char; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL let mut _6: char; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
scope 2 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL scope 2 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL
debug self => _6; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL debug self => _4; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
let mut _9: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
} }
} }
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { // at $DIR/issue_59352.rs:14:26: 14:50 scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { // at $DIR/issue_59352.rs:14:26: 14:50
debug self => _3; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL debug self => _2; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
let mut _10: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL let mut _7: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
let mut _11: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL let mut _8: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
scope 4 { scope 4 {
debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
} }
} }
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:11 StorageLive(_3); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
_2 = _1; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:11 StorageLive(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageLive(_5); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 StorageLive(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageLive(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageLive(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageLive(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _6 = _1; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageLive(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _5 = char::methods::<impl char>::to_digit(move _6, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
_8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
_7 = char::methods::<impl char>::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/char/methods.rs:LL:COL // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) } // + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
} }
bb1: { bb1: {
StorageDead(_12); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
StorageLive(_3); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 _2 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
StorageLive(_4); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:29
_4 = _1; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:29
_3 = char::methods::<impl char>::to_digit(move _4, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
// mir::Constant // mir::Constant
// + span: $DIR/issue_59352.rs:14:30: 14:38 // + span: $DIR/issue_59352.rs:14:30: 14:38
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) } // + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
} }
bb2: { bb2: {
StorageDead(_4); // scope 0 at $DIR/issue_59352.rs:+2:40: +2:41 _7 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
_10 = discriminant(_3); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL switchInt(move _7) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
} }
bb3: { bb3: {
StorageDead(_12); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
_0 = const 0_u32; // scope 0 at $DIR/issue_59352.rs:+2:60: +2:61 _0 = const 0_u32; // scope 0 at $DIR/issue_59352.rs:+2:60: +2:61
goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63
} }
@ -70,21 +60,18 @@ fn num_to_digit(_1: char) -> u32 {
} }
bb5: { bb5: {
_6 = &_7; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _4 = &_5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageDead(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
_9 = discriminant((*_6)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
StorageLive(_12); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_12 = move _9; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageDead(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _9 = discriminant((*_4)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
StorageDead(_5); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageDead(_2); // scope 0 at $DIR/issue_59352.rs:+2:22: +2:23 StorageDead(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
switchInt(move _12) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
switchInt(move _9) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
} }
bb6: { bb6: {
StorageLive(_11); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL StorageLive(_8); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
_11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL _8 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/option.rs:LL:COL // + span: $SRC_DIR/core/src/option.rs:LL:COL
// + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(<ZST>) } // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(<ZST>) }
@ -98,8 +85,8 @@ fn num_to_digit(_1: char) -> u32 {
} }
bb8: { bb8: {
_0 = move ((_3 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL _0 = move ((_2 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50 StorageDead(_2); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50
goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63
} }
} }

View file

@ -7,9 +7,8 @@ fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
let mut _3: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 let mut _3: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27
let mut _4: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:13 let mut _4: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:13
let mut _5: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:16: +1:27 let mut _5: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:16: +1:27
let _6: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:15: +2:20 let mut _6: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
let mut _7: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 let mut _7: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
let mut _8: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
bb0: { bb0: {
StorageLive(_3); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 StorageLive(_3); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27
@ -24,16 +23,13 @@ fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
} }
bb1: { bb1: {
StorageLive(_6); // scope 0 at $DIR/lower_array_len_e2e.rs:+2:15: +2:20 _6 = const N; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
_6 = _1; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:15: +2:20 _7 = Lt(_1, _6); // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
_7 = const N; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _1) -> bb2; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
_8 = Lt(_6, _7); // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
} }
bb2: { bb2: {
_0 = (*_2)[_6]; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 _0 = (*_2)[_1]; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
StorageDead(_6); // scope 0 at $DIR/lower_array_len_e2e.rs:+3:5: +3:6
goto -> bb4; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:5: +5:6 goto -> bb4; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:5: +5:6
} }

View file

@ -7,12 +7,11 @@ fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 {
let mut _3: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 let mut _3: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27
let mut _4: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:13 let mut _4: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:13
let mut _5: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:16: +1:27 let mut _5: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+1:16: +1:27
let _6: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:15: +2:20 let mut _6: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
let mut _7: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 let mut _7: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
let mut _8: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 let _8: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+4:15: +4:16
let _9: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+4:15: +4:16 let mut _9: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17
let mut _10: usize; // in scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17 let mut _10: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17
let mut _11: bool; // in scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17
bb0: { bb0: {
StorageLive(_3); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 StorageLive(_3); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27
@ -27,30 +26,27 @@ fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 {
} }
bb1: { bb1: {
StorageLive(_6); // scope 0 at $DIR/lower_array_len_e2e.rs:+2:15: +2:20 _6 = const N; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
_6 = _1; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:15: +2:20 _7 = Lt(_1, _6); // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
_7 = const N; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _1) -> bb2; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
_8 = Lt(_6, _7); // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
} }
bb2: { bb2: {
_0 = (*_2)[_6]; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21 _0 = (*_2)[_1]; // scope 0 at $DIR/lower_array_len_e2e.rs:+2:9: +2:21
StorageDead(_6); // scope 0 at $DIR/lower_array_len_e2e.rs:+3:5: +3:6
goto -> bb5; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:5: +7:6 goto -> bb5; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:5: +7:6
} }
bb3: { bb3: {
StorageLive(_9); // scope 0 at $DIR/lower_array_len_e2e.rs:+4:15: +4:16 StorageLive(_8); // scope 0 at $DIR/lower_array_len_e2e.rs:+4:15: +4:16
_9 = const 0_usize; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:15: +4:16 _8 = const 0_usize; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:15: +4:16
_10 = const N; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17 _9 = const N; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17
_11 = Lt(const 0_usize, _10); // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17 _10 = Lt(const 0_usize, _9); // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17
assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, const 0_usize) -> bb4; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17 assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, const 0_usize) -> bb4; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:17
} }
bb4: { bb4: {
(*_2)[_9] = const 42_u8; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:22 (*_2)[_8] = const 42_u8; // scope 0 at $DIR/lower_array_len_e2e.rs:+4:9: +4:22
StorageDead(_9); // scope 0 at $DIR/lower_array_len_e2e.rs:+4:22: +4:23 StorageDead(_8); // scope 0 at $DIR/lower_array_len_e2e.rs:+4:22: +4:23
_0 = const 42_u8; // scope 0 at $DIR/lower_array_len_e2e.rs:+6:9: +6:11 _0 = const 42_u8; // scope 0 at $DIR/lower_array_len_e2e.rs:+6:9: +6:11
goto -> bb5; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:5: +7:6 goto -> bb5; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:5: +7:6
} }

View file

@ -6,7 +6,6 @@ fn f_unit() -> () {
scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics_e2e.rs:9:5: 9:19 scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics_e2e.rs:9:5: 9:19
debug t => _1; // in scope 1 at $DIR/lower_intrinsics_e2e.rs:19:22: 19:23 debug t => _1; // in scope 1 at $DIR/lower_intrinsics_e2e.rs:19:22: 19:23
let _2: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17 let _2: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17
let mut _3: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:21:15: 21:16
scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics_e2e.rs:20:8: 20:32 scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics_e2e.rs:20:8: 20:32
} }
} }
@ -14,15 +13,13 @@ fn f_unit() -> () {
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:16: +1:18 StorageLive(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:16: +1:18
StorageLive(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17 StorageLive(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17
StorageLive(_3); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:15: 21:16 _2 = f_zst::<()>(move _1) -> bb1; // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17
_2 = f_zst::<()>(move _3) -> bb1; // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics_e2e.rs:21:9: 21:14 // + span: $DIR/lower_intrinsics_e2e.rs:21:9: 21:14
// + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(<ZST>) } // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(<ZST>) }
} }
bb1: { bb1: {
StorageDead(_3); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:16: 21:17
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:17: 21:18 StorageDead(_2); // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:17: 21:18
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:18: +1:19 StorageDead(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:18: +1:19
return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2 return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2

View file

@ -3,77 +3,56 @@
fn new(_1: Result<T, E>) -> Result<T, E> { fn new(_1: Result<T, E>) -> Result<T, E> {
debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15 debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15
let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46 let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46
let mut _2: T; // in scope 0 at $DIR/try_identity_e2e.rs:+2:9: +10:10 let mut _2: std::ops::ControlFlow<E, T>; // in scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
let mut _3: std::ops::ControlFlow<E, T>; // in scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 let mut _3: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:22
let mut _4: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:22 let mut _4: T; // in scope 0 at $DIR/try_identity_e2e.rs:+4:48: +4:49
let _5: T; // in scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21 let mut _5: E; // in scope 0 at $DIR/try_identity_e2e.rs:+5:46: +5:47
let mut _6: T; // in scope 0 at $DIR/try_identity_e2e.rs:+4:48: +4:49 let mut _6: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+8:13: +8:37
let _7: E; // in scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22 let _7: T; // in scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36
let mut _8: E; // in scope 0 at $DIR/try_identity_e2e.rs:+5:46: +5:47 let mut _8: E; // in scope 0 at $DIR/try_identity_e2e.rs:+9:49: +9:50
let mut _9: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+8:13: +8:37
let _10: T; // in scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36
let _11: E; // in scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33
let mut _12: E; // in scope 0 at $DIR/try_identity_e2e.rs:+9:49: +9:50
scope 1 { scope 1 {
debug v => _5; // in scope 1 at $DIR/try_identity_e2e.rs:+4:20: +4:21 debug v => _4; // in scope 1 at $DIR/try_identity_e2e.rs:+4:20: +4:21
} }
scope 2 { scope 2 {
debug e => _7; // in scope 2 at $DIR/try_identity_e2e.rs:+5:21: +5:22 debug e => _5; // in scope 2 at $DIR/try_identity_e2e.rs:+5:21: +5:22
} }
scope 3 { scope 3 {
debug v => _10; // in scope 3 at $DIR/try_identity_e2e.rs:+8:35: +8:36 debug v => _7; // in scope 3 at $DIR/try_identity_e2e.rs:+8:35: +8:36
} }
scope 4 { scope 4 {
debug e => _11; // in scope 4 at $DIR/try_identity_e2e.rs:+9:32: +9:33 debug e => _8; // in scope 4 at $DIR/try_identity_e2e.rs:+9:32: +9:33
} }
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +10:10 StorageLive(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
StorageLive(_3); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 _3 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20
_4 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20 switchInt(move _3) -> [0_isize: bb2, 1_isize: bb1, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:20
switchInt(move _4) -> [0_isize: bb2, 1_isize: bb1, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:20
} }
bb1: { bb1: {
StorageLive(_7); // scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22 _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22
_7 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22 Deinit(_2); // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48
StorageLive(_8); // scope 2 at $DIR/try_identity_e2e.rs:+5:46: +5:47 ((_2 as Break).0: E) = move _5; // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48
_8 = move _7; // scope 2 at $DIR/try_identity_e2e.rs:+5:46: +5:47 discriminant(_2) = 1; // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48
Deinit(_3); // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48 _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
((_3 as Break).0: E) = move _8; // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48 switchInt(move _6) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10
discriminant(_3) = 1; // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48
StorageDead(_8); // scope 2 at $DIR/try_identity_e2e.rs:+5:47: +5:48
StorageDead(_7); // scope 0 at $DIR/try_identity_e2e.rs:+5:47: +5:48
_9 = discriminant(_3); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
switchInt(move _9) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10
} }
bb2: { bb2: {
StorageLive(_5); // scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21 _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21
_5 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21 Deinit(_2); // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50
StorageLive(_6); // scope 1 at $DIR/try_identity_e2e.rs:+4:48: +4:49 ((_2 as Continue).0: T) = move _4; // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50
_6 = move _5; // scope 1 at $DIR/try_identity_e2e.rs:+4:48: +4:49 discriminant(_2) = 0; // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50
Deinit(_3); // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50 _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
((_3 as Continue).0: T) = move _6; // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50 switchInt(move _6) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10
discriminant(_3) = 0; // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50
StorageDead(_6); // scope 1 at $DIR/try_identity_e2e.rs:+4:49: +4:50
StorageDead(_5); // scope 0 at $DIR/try_identity_e2e.rs:+4:49: +4:50
_9 = discriminant(_3); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
switchInt(move _9) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10
} }
bb3: { bb3: {
StorageLive(_11); // scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33 _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33
_11 = move ((_3 as Break).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33
StorageLive(_12); // scope 4 at $DIR/try_identity_e2e.rs:+9:49: +9:50
_12 = move _11; // scope 4 at $DIR/try_identity_e2e.rs:+9:49: +9:50
Deinit(_0); // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51 Deinit(_0); // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51
((_0 as Err).0: E) = move _12; // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51 ((_0 as Err).0: E) = move _8; // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51
discriminant(_0) = 1; // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51 discriminant(_0) = 1; // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51
StorageDead(_12); // scope 4 at $DIR/try_identity_e2e.rs:+9:50: +9:51 StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
StorageDead(_11); // scope 0 at $DIR/try_identity_e2e.rs:+9:50: +9:51
StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+11:5: +11:6
StorageDead(_3); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2 return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
} }
@ -82,15 +61,11 @@ fn new(_1: Result<T, E>) -> Result<T, E> {
} }
bb5: { bb5: {
StorageLive(_10); // scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36 _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36
_10 = move ((_3 as Continue).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36
_2 = move _10; // scope 3 at $DIR/try_identity_e2e.rs:+8:41: +8:42
StorageDead(_10); // scope 0 at $DIR/try_identity_e2e.rs:+8:41: +8:42
Deinit(_0); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6 Deinit(_0); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6
((_0 as Ok).0: T) = move _2; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6 ((_0 as Ok).0: T) = move _7; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6
discriminant(_0) = 0; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6 discriminant(_0) = 0; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6
StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+11:5: +11:6 StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
StorageDead(_3); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2 return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
} }
} }

View file

@ -3,35 +3,26 @@
fn old(_1: Result<T, E>) -> Result<T, E> { fn old(_1: Result<T, E>) -> Result<T, E> {
debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15 debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15
let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46 let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46
let mut _2: T; // in scope 0 at $DIR/try_identity_e2e.rs:+2:9: +5:10 let mut _2: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:18
let mut _3: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:18 let _3: T; // in scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17
let _4: T; // in scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17 let mut _4: E; // in scope 0 at $DIR/try_identity_e2e.rs:+4:34: +4:35
let _5: E; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18
let mut _6: E; // in scope 0 at $DIR/try_identity_e2e.rs:+4:34: +4:35
scope 1 { scope 1 {
debug v => _4; // in scope 1 at $DIR/try_identity_e2e.rs:+3:16: +3:17 debug v => _3; // in scope 1 at $DIR/try_identity_e2e.rs:+3:16: +3:17
} }
scope 2 { scope 2 {
debug e => _5; // in scope 2 at $DIR/try_identity_e2e.rs:+4:17: +4:18 debug e => _4; // in scope 2 at $DIR/try_identity_e2e.rs:+4:17: +4:18
} }
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +5:10 _2 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16
_3 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16 switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +2:16
switchInt(move _3) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +2:16
} }
bb1: { bb1: {
StorageLive(_5); // scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18 _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18
_5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18
StorageLive(_6); // scope 2 at $DIR/try_identity_e2e.rs:+4:34: +4:35
_6 = move _5; // scope 2 at $DIR/try_identity_e2e.rs:+4:34: +4:35
Deinit(_0); // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36 Deinit(_0); // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36
((_0 as Err).0: E) = move _6; // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36 ((_0 as Err).0: E) = move _4; // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36
discriminant(_0) = 1; // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36 discriminant(_0) = 1; // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36
StorageDead(_6); // scope 2 at $DIR/try_identity_e2e.rs:+4:35: +4:36
StorageDead(_5); // scope 0 at $DIR/try_identity_e2e.rs:+4:35: +4:36
StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+6:5: +6:6
return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2 return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2
} }
@ -40,14 +31,10 @@ fn old(_1: Result<T, E>) -> Result<T, E> {
} }
bb3: { bb3: {
StorageLive(_4); // scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17 _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17
_4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17
_2 = move _4; // scope 1 at $DIR/try_identity_e2e.rs:+3:22: +3:23
StorageDead(_4); // scope 0 at $DIR/try_identity_e2e.rs:+3:22: +3:23
Deinit(_0); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6 Deinit(_0); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6
((_0 as Ok).0: T) = move _2; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6 ((_0 as Ok).0: T) = move _3; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6
discriminant(_0) = 0; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6 discriminant(_0) = 0; // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6
StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+6:5: +6:6
return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2 return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2
} }
} }

View file

@ -1,5 +1,5 @@
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:12:13 --> $DIR/large_moves.rs:13:13
| |
LL | let x = async { LL | let x = async {
| _____________^ | _____________^
@ -18,7 +18,7 @@ LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:18:14 --> $DIR/large_moves.rs:19:14
| |
LL | let z = (x, 42); LL | let z = (x, 42);
| ^ value moved from here | ^ value moved from here
@ -26,7 +26,7 @@ LL | let z = (x, 42);
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:18:13 --> $DIR/large_moves.rs:19:13
| |
LL | let z = (x, 42); LL | let z = (x, 42);
| ^^^^^^^ value moved from here | ^^^^^^^ value moved from here
@ -34,7 +34,7 @@ LL | let z = (x, 42);
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:20:13 --> $DIR/large_moves.rs:21:13
| |
LL | let a = z.0; LL | let a = z.0;
| ^^^ value moved from here | ^^^ value moved from here

View file

@ -1,5 +1,5 @@
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:12:13 --> $DIR/large_moves.rs:13:13
| |
LL | let x = async { LL | let x = async {
| _____________^ | _____________^
@ -18,7 +18,7 @@ LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:18:14 --> $DIR/large_moves.rs:19:14
| |
LL | let z = (x, 42); LL | let z = (x, 42);
| ^ value moved from here | ^ value moved from here
@ -26,7 +26,7 @@ LL | let z = (x, 42);
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:18:13 --> $DIR/large_moves.rs:19:13
| |
LL | let z = (x, 42); LL | let z = (x, 42);
| ^^^^^^^ value moved from here | ^^^^^^^ value moved from here
@ -34,7 +34,7 @@ LL | let z = (x, 42);
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
error: moving 10024 bytes error: moving 10024 bytes
--> $DIR/large_moves.rs:20:13 --> $DIR/large_moves.rs:21:13
| |
LL | let a = z.0; LL | let a = z.0;
| ^^^ value moved from here | ^^^ value moved from here

View file

@ -7,6 +7,7 @@
// [option]compile-flags: -Zmove-size-limit=1000 // [option]compile-flags: -Zmove-size-limit=1000
// edition:2018 // edition:2018
// compile-flags: -Zmir-opt-level=0
fn main() { fn main() {
let x = async { //~ ERROR large_assignments let x = async { //~ ERROR large_assignments