Use record_operands_moved more aggresively

This commit is contained in:
Matthew Jasper 2020-10-24 11:18:32 +01:00
parent b766abc88f
commit 7f3e8551dd
13 changed files with 128 additions and 241 deletions

View File

@ -11,6 +11,8 @@ use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty, UpvarSubsts};
use rustc_span::Span;
use std::slice;
impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Returns an rvalue suitable for use until the end of the current
/// scope expression.
@ -117,7 +119,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block =
this.into(this.hir.tcx().mk_place_deref(Place::from(result)), block, value)
);
block.and(Rvalue::Use(Operand::Move(Place::from(result))))
let result_operand = Operand::Move(Place::from(result));
this.record_operands_moved(slice::from_ref(&result_operand));
block.and(Rvalue::Use(result_operand))
}
ExprKind::Cast { source } => {
let source = unpack!(block = this.as_operand(block, scope, source));
@ -161,6 +165,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
.map(|f| unpack!(block = this.as_operand(block, scope, f)))
.collect();
this.record_operands_moved(&fields);
block.and(Rvalue::Aggregate(box AggregateKind::Array(el_ty), fields))
}
ExprKind::Tuple { fields } => {
@ -171,6 +176,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
.map(|f| unpack!(block = this.as_operand(block, scope, f)))
.collect();
this.record_operands_moved(&fields);
block.and(Rvalue::Aggregate(box AggregateKind::Tuple, fields))
}
ExprKind::Closure { closure_id, substs, upvars, movability } => {
@ -222,6 +228,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
UpvarSubsts::Closure(substs) => box AggregateKind::Closure(closure_id, substs),
};
this.record_operands_moved(&operands);
block.and(Rvalue::Aggregate(result, operands))
}
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {

View File

@ -10,9 +10,10 @@ use rustc_hir as hir;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation};
use rustc_span::symbol::sym;
use rustc_target::spec::abi::Abi;
use std::slice;
impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Compile `expr`, storing the result into `destination`, which
/// is assumed to be uninitialized.
@ -271,7 +272,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let field_names = this.hir.all_fields(adt_def, variant_index);
let fields = if let Some(FruInfo { base, field_types }) = base {
let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base {
let base = unpack!(block = this.as_place(block, base));
// MIR does not natively support FRU, so for each
@ -306,6 +307,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
user_ty,
active_field_index,
);
this.record_operands_moved(&fields);
this.cfg.push_assign(
block,
source_info,
@ -432,6 +434,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let scope = this.local_scope();
let value = unpack!(block = this.as_operand(block, scope, value));
let resume = this.cfg.start_new_block();
this.record_operands_moved(slice::from_ref(&value));
this.cfg.terminate(
block,
source_info,

View File

@ -3,6 +3,7 @@ use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use crate::thir::*;
use rustc_middle::middle::region;
use rustc_middle::mir::*;
use std::slice;
impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Builds a block of MIR statements to evaluate the THIR `expr`.
@ -46,6 +47,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
if this.hir.needs_drop(lhs.ty) {
let rhs = unpack!(block = this.as_local_operand(block, rhs));
let lhs = unpack!(block = this.as_place(block, lhs));
this.record_operands_moved(slice::from_ref(&rhs));
unpack!(block = this.build_drop_and_replace(block, lhs_span, lhs, rhs));
} else {
let rhs = unpack!(block = this.as_local_rvalue(block, rhs));

View File

@ -83,7 +83,7 @@ that contains only loops and breakable blocks. It tracks where a `break`,
use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG};
use crate::thir::{Expr, ExprRef, LintLevel};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir as hir;
use rustc_index::vec::IndexVec;
use rustc_middle::middle::region;
@ -1379,7 +1379,7 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
| TerminatorKind::Yield { .. }
| TerminatorKind::GeneratorDrop
| TerminatorKind::FalseEdge { .. }
| TerminatorKind::InlineAsm {.. } => {
| TerminatorKind::InlineAsm { .. } => {
span_bug!(term.source_info.span, "cannot unwind from {:?}", term.kind)
}
}

View File

@ -41,44 +41,36 @@ fn main() -> () {
StorageLive(_5); // scope 3 at $DIR/basic_assignment.rs:19:9: 19:15
StorageLive(_6); // scope 4 at $DIR/basic_assignment.rs:23:14: 23:20
_6 = move _4; // scope 4 at $DIR/basic_assignment.rs:23:14: 23:20
replace(_5 <- move _6) -> [return: bb1, unwind: bb5]; // scope 4 at $DIR/basic_assignment.rs:23:5: 23:11
replace(_5 <- move _6) -> [return: bb1, unwind: bb4]; // scope 4 at $DIR/basic_assignment.rs:23:5: 23:11
}
bb1: {
drop(_6) -> [return: bb2, unwind: bb6]; // scope 4 at $DIR/basic_assignment.rs:23:19: 23:20
StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:23:19: 23:20
_0 = const (); // scope 0 at $DIR/basic_assignment.rs:10:11: 24:2
drop(_5) -> [return: bb2, unwind: bb5]; // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb2: {
StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:23:19: 23:20
_0 = const (); // scope 0 at $DIR/basic_assignment.rs:10:11: 24:2
drop(_5) -> [return: bb3, unwind: bb7]; // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
StorageDead(_5); // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
drop(_4) -> [return: bb3, unwind: bb6]; // scope 2 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb3: {
StorageDead(_5); // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
drop(_4) -> [return: bb4, unwind: bb8]; // scope 2 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb4: {
StorageDead(_4); // scope 2 at $DIR/basic_assignment.rs:24:1: 24:2
StorageDead(_2); // scope 1 at $DIR/basic_assignment.rs:24:1: 24:2
StorageDead(_1); // scope 0 at $DIR/basic_assignment.rs:24:1: 24:2
return; // scope 0 at $DIR/basic_assignment.rs:24:2: 24:2
}
bb4 (cleanup): {
drop(_5) -> bb5; // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb5 (cleanup): {
drop(_6) -> bb6; // scope 4 at $DIR/basic_assignment.rs:23:19: 23:20
drop(_4) -> bb6; // scope 2 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb6 (cleanup): {
drop(_5) -> bb7; // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb7 (cleanup): {
drop(_4) -> bb8; // scope 2 at $DIR/basic_assignment.rs:24:1: 24:2
}
bb8 (cleanup): {
resume; // scope 0 at $DIR/basic_assignment.rs:10:1: 24:2
}
}

View File

@ -14,7 +14,7 @@ fn main() -> () {
StorageLive(_1); // scope 0 at $DIR/box_expr.rs:7:9: 7:10
StorageLive(_2); // scope 0 at $DIR/box_expr.rs:7:13: 7:25
_2 = Box(S); // scope 0 at $DIR/box_expr.rs:7:13: 7:25
(*_2) = S::new() -> [return: bb1, unwind: bb7]; // scope 0 at $DIR/box_expr.rs:7:17: 7:25
(*_2) = S::new() -> [return: bb1, unwind: bb5]; // scope 0 at $DIR/box_expr.rs:7:17: 7:25
// mir::Constant
// + span: $DIR/box_expr.rs:7:17: 7:23
// + literal: Const { ty: fn() -> S {S::new}, val: Value(Scalar(<ZST>)) }
@ -22,45 +22,37 @@ fn main() -> () {
bb1: {
_1 = move _2; // scope 0 at $DIR/box_expr.rs:7:13: 7:25
drop(_2) -> bb2; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
}
bb2: {
StorageDead(_2); // scope 0 at $DIR/box_expr.rs:7:24: 7:25
StorageLive(_3); // scope 1 at $DIR/box_expr.rs:8:5: 8:12
StorageLive(_4); // scope 1 at $DIR/box_expr.rs:8:10: 8:11
_4 = move _1; // scope 1 at $DIR/box_expr.rs:8:10: 8:11
_3 = std::mem::drop::<Box<S>>(move _4) -> [return: bb3, unwind: bb5]; // scope 1 at $DIR/box_expr.rs:8:5: 8:12
_3 = std::mem::drop::<Box<S>>(move _4) -> [return: bb2, unwind: bb4]; // scope 1 at $DIR/box_expr.rs:8:5: 8:12
// mir::Constant
// + span: $DIR/box_expr.rs:8:5: 8:9
// + literal: Const { ty: fn(std::boxed::Box<S>) {std::mem::drop::<std::boxed::Box<S>>}, val: Value(Scalar(<ZST>)) }
}
bb3: {
bb2: {
StorageDead(_4); // scope 1 at $DIR/box_expr.rs:8:11: 8:12
StorageDead(_3); // scope 1 at $DIR/box_expr.rs:8:12: 8:13
_0 = const (); // scope 0 at $DIR/box_expr.rs:6:11: 9:2
drop(_1) -> bb4; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
drop(_1) -> bb3; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
}
bb4: {
bb3: {
StorageDead(_1); // scope 0 at $DIR/box_expr.rs:9:1: 9:2
return; // scope 0 at $DIR/box_expr.rs:9:2: 9:2
}
bb4 (cleanup): {
drop(_1) -> bb6; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
}
bb5 (cleanup): {
drop(_4) -> bb6; // scope 1 at $DIR/box_expr.rs:8:11: 8:12
drop(_2) -> bb6; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
}
bb6 (cleanup): {
drop(_1) -> bb8; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
}
bb7 (cleanup): {
drop(_2) -> bb8; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
}
bb8 (cleanup): {
resume; // scope 0 at $DIR/box_expr.rs:6:1: 9:2
}
}

View File

@ -6,21 +6,18 @@ fn main() -> () {
let mut _2: S; // in scope 0 at $DIR/issue-41110.rs:8:13: 8:14
let mut _3: S; // in scope 0 at $DIR/issue-41110.rs:8:21: 8:27
let mut _4: S; // in scope 0 at $DIR/issue-41110.rs:8:21: 8:22
let mut _5: bool; // in scope 0 at $DIR/issue-41110.rs:8:27: 8:28
scope 1 {
debug x => _1; // in scope 1 at $DIR/issue-41110.rs:8:9: 8:10
}
bb0: {
_5 = const false; // scope 0 at $DIR/issue-41110.rs:8:9: 8:10
StorageLive(_1); // scope 0 at $DIR/issue-41110.rs:8:9: 8:10
StorageLive(_2); // scope 0 at $DIR/issue-41110.rs:8:13: 8:14
_5 = const true; // scope 0 at $DIR/issue-41110.rs:8:13: 8:14
_2 = S; // scope 0 at $DIR/issue-41110.rs:8:13: 8:14
StorageLive(_3); // scope 0 at $DIR/issue-41110.rs:8:21: 8:27
StorageLive(_4); // scope 0 at $DIR/issue-41110.rs:8:21: 8:22
_4 = S; // scope 0 at $DIR/issue-41110.rs:8:21: 8:22
_3 = S::id(move _4) -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/issue-41110.rs:8:21: 8:27
_3 = S::id(move _4) -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue-41110.rs:8:21: 8:27
// mir::Constant
// + span: $DIR/issue-41110.rs:8:23: 8:25
// + literal: Const { ty: fn(S) -> S {S::id}, val: Value(Scalar(<ZST>)) }
@ -28,8 +25,7 @@ fn main() -> () {
bb1: {
StorageDead(_4); // scope 0 at $DIR/issue-41110.rs:8:26: 8:27
_5 = const false; // scope 0 at $DIR/issue-41110.rs:8:13: 8:28
_1 = S::other(move _2, move _3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/issue-41110.rs:8:13: 8:28
_1 = S::other(move _2, move _3) -> bb2; // scope 0 at $DIR/issue-41110.rs:8:13: 8:28
// mir::Constant
// + span: $DIR/issue-41110.rs:8:15: 8:20
// + literal: Const { ty: fn(S, S) {S::other}, val: Value(Scalar(<ZST>)) }
@ -37,7 +33,6 @@ fn main() -> () {
bb2: {
StorageDead(_3); // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
_5 = const false; // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
StorageDead(_2); // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
_0 = const (); // scope 0 at $DIR/issue-41110.rs:7:11: 9:2
StorageDead(_1); // scope 0 at $DIR/issue-41110.rs:9:1: 9:2
@ -45,26 +40,10 @@ fn main() -> () {
}
bb3 (cleanup): {
goto -> bb5; // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
drop(_2) -> bb4; // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb4 (cleanup): {
goto -> bb5; // scope 0 at $DIR/issue-41110.rs:8:26: 8:27
}
bb5 (cleanup): {
goto -> bb8; // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb6 (cleanup): {
resume; // scope 0 at $DIR/issue-41110.rs:7:1: 9:2
}
bb7 (cleanup): {
drop(_2) -> bb6; // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
bb8 (cleanup): {
switchInt(_5) -> [false: bb6, otherwise: bb7]; // scope 0 at $DIR/issue-41110.rs:8:27: 8:28
}
}

View File

@ -25,7 +25,7 @@ fn test() -> () {
StorageLive(_3); // scope 2 at $DIR/issue-41110.rs:17:5: 17:12
StorageLive(_4); // scope 2 at $DIR/issue-41110.rs:17:10: 17:11
_4 = move _2; // scope 2 at $DIR/issue-41110.rs:17:10: 17:11
_3 = std::mem::drop::<S>(move _4) -> [return: bb1, unwind: bb7]; // scope 2 at $DIR/issue-41110.rs:17:5: 17:12
_3 = std::mem::drop::<S>(move _4) -> [return: bb1, unwind: bb5]; // scope 2 at $DIR/issue-41110.rs:17:5: 17:12
// mir::Constant
// + span: $DIR/issue-41110.rs:17:5: 17:9
// + literal: Const { ty: fn(S) {std::mem::drop::<S>}, val: Value(Scalar(<ZST>)) }
@ -37,65 +37,53 @@ fn test() -> () {
StorageLive(_5); // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
_6 = const false; // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
_5 = move _1; // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
goto -> bb12; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
goto -> bb9; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
}
bb2: {
goto -> bb3; // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
StorageDead(_5); // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
_0 = const (); // scope 0 at $DIR/issue-41110.rs:14:15: 19:2
drop(_2) -> [return: bb3, unwind: bb6]; // scope 1 at $DIR/issue-41110.rs:19:1: 19:2
}
bb3: {
StorageDead(_5); // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
_0 = const (); // scope 0 at $DIR/issue-41110.rs:14:15: 19:2
drop(_2) -> [return: bb4, unwind: bb9]; // scope 1 at $DIR/issue-41110.rs:19:1: 19:2
StorageDead(_2); // scope 1 at $DIR/issue-41110.rs:19:1: 19:2
goto -> bb4; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb4: {
StorageDead(_2); // scope 1 at $DIR/issue-41110.rs:19:1: 19:2
goto -> bb5; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb5: {
_6 = const false; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
StorageDead(_1); // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
return; // scope 0 at $DIR/issue-41110.rs:19:2: 19:2
}
bb5 (cleanup): {
goto -> bb6; // scope 1 at $DIR/issue-41110.rs:19:1: 19:2
}
bb6 (cleanup): {
goto -> bb8; // scope 2 at $DIR/issue-41110.rs:18:9: 18:10
goto -> bb11; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb7 (cleanup): {
goto -> bb8; // scope 2 at $DIR/issue-41110.rs:17:11: 17:12
}
bb8 (cleanup): {
goto -> bb9; // scope 1 at $DIR/issue-41110.rs:19:1: 19:2
}
bb9 (cleanup): {
goto -> bb14; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb10 (cleanup): {
resume; // scope 0 at $DIR/issue-41110.rs:14:1: 19:2
}
bb11 (cleanup): {
bb8 (cleanup): {
_2 = move _5; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
goto -> bb6; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
goto -> bb5; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
}
bb12: {
bb9: {
_2 = move _5; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
goto -> bb2; // scope 2 at $DIR/issue-41110.rs:18:5: 18:6
}
bb13 (cleanup): {
drop(_1) -> bb10; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
bb10 (cleanup): {
drop(_1) -> bb7; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
bb14 (cleanup): {
switchInt(_6) -> [false: bb10, otherwise: bb13]; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
bb11 (cleanup): {
switchInt(_6) -> [false: bb7, otherwise: bb10]; // scope 0 at $DIR/issue-41110.rs:19:1: 19:2
}
}

View File

@ -26,7 +26,7 @@ fn main() -> () {
_8 = const false; // scope 0 at $DIR/issue-41888.rs:7:9: 7:10
StorageLive(_1); // scope 0 at $DIR/issue-41888.rs:7:9: 7:10
StorageLive(_2); // scope 1 at $DIR/issue-41888.rs:8:8: 8:14
_2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14
_2 = cond() -> [return: bb1, unwind: bb9]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14
// mir::Constant
// + span: $DIR/issue-41888.rs:8:8: 8:12
// + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar(<ZST>)) }
@ -38,7 +38,7 @@ fn main() -> () {
bb2: {
_0 = const (); // scope 1 at $DIR/issue-41888.rs:14:6: 14:6
goto -> bb8; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6
goto -> bb7; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6
}
bb3: {
@ -47,38 +47,34 @@ fn main() -> () {
_4 = K; // scope 1 at $DIR/issue-41888.rs:9:18: 9:19
_3 = E::F(move _4); // scope 1 at $DIR/issue-41888.rs:9:13: 9:20
StorageDead(_4); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20
goto -> bb14; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
goto -> bb12; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
}
bb4: {
goto -> bb5; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20
StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20
_5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24
switchInt(move _5) -> [0_isize: bb6, otherwise: bb5]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24
}
bb5: {
StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20
_5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24
switchInt(move _5) -> [0_isize: bb7, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24
_0 = const (); // scope 1 at $DIR/issue-41888.rs:13:10: 13:10
goto -> bb7; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10
}
bb6: {
_0 = const (); // scope 1 at $DIR/issue-41888.rs:13:10: 13:10
goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10
}
bb7: {
StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23
_9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23
_6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23
_0 = const (); // scope 2 at $DIR/issue-41888.rs:10:29: 13:10
StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10
goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10
goto -> bb7; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10
}
bb7: {
goto -> bb18; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb8: {
goto -> bb20; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb9: {
_7 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
_8 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
_9 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
@ -87,27 +83,23 @@ fn main() -> () {
return; // scope 0 at $DIR/issue-41888.rs:15:2: 15:2
}
bb9 (cleanup): {
goto -> bb10; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb10 (cleanup): {
goto -> bb11; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20
}
bb11 (cleanup): {
goto -> bb12; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb12 (cleanup): {
resume; // scope 0 at $DIR/issue-41888.rs:6:1: 15:2
}
bb13 (cleanup): {
bb11 (cleanup): {
_7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
_8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
_9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
_1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
goto -> bb10; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
goto -> bb9; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
}
bb14: {
bb12: {
_7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
_8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
_9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
@ -115,38 +107,38 @@ fn main() -> () {
goto -> bb4; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10
}
bb15: {
bb13: {
_7 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
goto -> bb9; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
goto -> bb8; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb14 (cleanup): {
goto -> bb10; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb15: {
drop(_1) -> [return: bb13, unwind: bb10]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb16 (cleanup): {
goto -> bb12; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
drop(_1) -> bb10; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb17: {
drop(_1) -> [return: bb15, unwind: bb12]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb18 (cleanup): {
drop(_1) -> bb12; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb19: {
_10 = discriminant(_1); // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
switchInt(move _10) -> [0_isize: bb15, otherwise: bb17]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
switchInt(move _10) -> [0_isize: bb13, otherwise: bb15]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb20: {
switchInt(_7) -> [false: bb15, otherwise: bb19]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
bb18: {
switchInt(_7) -> [false: bb13, otherwise: bb17]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb21 (cleanup): {
bb19 (cleanup): {
_11 = discriminant(_1); // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
switchInt(move _11) -> [0_isize: bb16, otherwise: bb18]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
switchInt(move _11) -> [0_isize: bb14, otherwise: bb16]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
bb22 (cleanup): {
switchInt(_7) -> [false: bb12, otherwise: bb21]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
bb20 (cleanup): {
switchInt(_7) -> [false: bb10, otherwise: bb19]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2
}
}

View File

@ -30,7 +30,7 @@ fn test() -> Option<Box<u32>> {
StorageLive(_3); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
StorageLive(_4); // scope 0 at $DIR/issue-62289.rs:9:15: 9:19
_4 = Option::<u32>::None; // scope 0 at $DIR/issue-62289.rs:9:15: 9:19
_3 = <Option<u32> as Try>::into_result(move _4) -> [return: bb1, unwind: bb12]; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
_3 = <Option<u32> as Try>::into_result(move _4) -> [return: bb1, unwind: bb9]; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
// mir::Constant
// + span: $DIR/issue-62289.rs:9:15: 9:20
// + literal: Const { ty: fn(std::option::Option<u32>) -> std::result::Result<<std::option::Option<u32> as std::ops::Try>::Ok, <std::option::Option<u32> as std::ops::Try>::Error> {<std::option::Option<u32> as std::ops::Try>::into_result}, val: Value(Scalar(<ZST>)) }
@ -48,7 +48,11 @@ fn test() -> Option<Box<u32>> {
(*_2) = _10; // scope 4 at $DIR/issue-62289.rs:9:15: 9:20
StorageDead(_10); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
_1 = move _2; // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
drop(_2) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
StorageDead(_2); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
_0 = Option::<Box<u32>>::Some(move _1); // scope 0 at $DIR/issue-62289.rs:9:5: 9:22
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_3); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
goto -> bb8; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
bb3: {
@ -61,7 +65,7 @@ fn test() -> Option<Box<u32>> {
StorageLive(_8); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
StorageLive(_9); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_9 = _6; // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_8 = <NoneError as From<NoneError>>::from(move _9) -> [return: bb5, unwind: bb12]; // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_8 = <NoneError as From<NoneError>>::from(move _9) -> [return: bb5, unwind: bb9]; // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
// mir::Constant
// + span: $DIR/issue-62289.rs:9:19: 9:20
// + literal: Const { ty: fn(std::option::NoneError) -> std::option::NoneError {<std::option::NoneError as std::convert::From<std::option::NoneError>>::from}, val: Value(Scalar(<ZST>)) }
@ -69,7 +73,7 @@ fn test() -> Option<Box<u32>> {
bb5: {
StorageDead(_9); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_0 = <Option<Box<u32>> as Try>::from_error(move _8) -> [return: bb6, unwind: bb12]; // scope 2 at $DIR/issue-62289.rs:9:15: 9:20
_0 = <Option<Box<u32>> as Try>::from_error(move _8) -> [return: bb6, unwind: bb9]; // scope 2 at $DIR/issue-62289.rs:9:15: 9:20
// mir::Constant
// + span: $DIR/issue-62289.rs:9:15: 9:20
// + literal: Const { ty: fn(<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::Error) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error}, val: Value(Scalar(<ZST>)) }
@ -78,41 +82,25 @@ fn test() -> Option<Box<u32>> {
bb6: {
StorageDead(_8); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
StorageDead(_6); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
drop(_2) -> bb9; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
drop(_2) -> bb7; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
}
bb7: {
StorageDead(_2); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
_0 = Option::<Box<u32>>::Some(move _1); // scope 0 at $DIR/issue-62289.rs:9:5: 9:22
drop(_1) -> bb8; // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_3); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
goto -> bb8; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
bb8: {
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_3); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
goto -> bb10; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
bb9: {
StorageDead(_2); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
StorageDead(_3); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
goto -> bb10; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
bb10: {
return; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
}
bb11 (cleanup): {
drop(_1) -> bb13; // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
bb9 (cleanup): {
drop(_2) -> bb10; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
}
bb12 (cleanup): {
drop(_2) -> bb13; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
}
bb13 (cleanup): {
bb10 (cleanup): {
resume; // scope 0 at $DIR/issue-62289.rs:8:1: 10:2
}
}

View File

@ -28,7 +28,7 @@ fn main() -> () {
bb1: {
StorageDead(_3); // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:33: 9:34
_1 = std::mem::drop::<String>(move _2) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:5: 9:35
_1 = std::mem::drop::<String>(move _2) -> bb2; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:5: 9:35
// mir::Constant
// + span: $DIR/no-spurious-drop-after-call.rs:9:5: 9:19
// + literal: Const { ty: fn(std::string::String) {std::mem::drop::<std::string::String>}, val: Value(Scalar(<ZST>)) }
@ -41,12 +41,4 @@ fn main() -> () {
_0 = const (); // scope 0 at $DIR/no-spurious-drop-after-call.rs:8:11: 10:2
return; // scope 0 at $DIR/no-spurious-drop-after-call.rs:10:2: 10:2
}
bb3 (cleanup): {
drop(_2) -> bb4; // scope 0 at $DIR/no-spurious-drop-after-call.rs:9:34: 9:35
}
bb4 (cleanup): {
resume; // scope 0 at $DIR/no-spurious-drop-after-call.rs:8:1: 10:2
}
}

View File

@ -22,62 +22,38 @@ fn move_out_by_subslice() -> () {
_3 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
(*_3) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
_2 = move _3; // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
drop(_3) -> [return: bb1, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
}
bb1: {
StorageDead(_3); // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
StorageLive(_4); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
StorageLive(_5); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
_5 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
(*_5) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
_4 = move _5; // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
drop(_5) -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
}
bb2: {
StorageDead(_5); // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
_1 = [move _2, move _4]; // scope 0 at $DIR/uniform_array_move_out.rs:11:13: 11:27
drop(_4) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
}
bb3: {
StorageDead(_4); // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
drop(_2) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
}
bb4: {
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
FakeRead(ForLet, _1); // scope 0 at $DIR/uniform_array_move_out.rs:11:9: 11:10
StorageLive(_6); // scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
_6 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:10:27: 13:2
drop(_6) -> [return: bb5, unwind: bb7]; // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
drop(_6) -> [return: bb1, unwind: bb3]; // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
}
bb5: {
bb1: {
StorageDead(_6); // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
drop(_1) -> [return: bb6, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
}
bb6: {
bb2: {
StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
return; // scope 0 at $DIR/uniform_array_move_out.rs:13:2: 13:2
}
bb7 (cleanup): {
drop(_1) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
bb3 (cleanup): {
drop(_1) -> bb4; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
}
bb8 (cleanup): {
drop(_4) -> bb9; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
}
bb9 (cleanup): {
drop(_2) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
}
bb10 (cleanup): {
bb4 (cleanup): {
resume; // scope 0 at $DIR/uniform_array_move_out.rs:10:1: 13:2
}
}

View File

@ -22,62 +22,38 @@ fn move_out_from_end() -> () {
_3 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
(*_3) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
_2 = move _3; // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
drop(_3) -> [return: bb1, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
}
bb1: {
StorageDead(_3); // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
StorageLive(_4); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
StorageLive(_5); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
_5 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
(*_5) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
_4 = move _5; // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
drop(_5) -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
}
bb2: {
StorageDead(_5); // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
_1 = [move _2, move _4]; // scope 0 at $DIR/uniform_array_move_out.rs:5:13: 5:27
drop(_4) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
}
bb3: {
StorageDead(_4); // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
drop(_2) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
}
bb4: {
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
FakeRead(ForLet, _1); // scope 0 at $DIR/uniform_array_move_out.rs:5:9: 5:10
StorageLive(_6); // scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
_6 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:4:24: 7:2
drop(_6) -> [return: bb5, unwind: bb7]; // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
drop(_6) -> [return: bb1, unwind: bb3]; // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
}
bb5: {
bb1: {
StorageDead(_6); // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
drop(_1) -> [return: bb6, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
}
bb6: {
bb2: {
StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
return; // scope 0 at $DIR/uniform_array_move_out.rs:7:2: 7:2
}
bb7 (cleanup): {
drop(_1) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
bb3 (cleanup): {
drop(_1) -> bb4; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
}
bb8 (cleanup): {
drop(_4) -> bb9; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
}
bb9 (cleanup): {
drop(_2) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
}
bb10 (cleanup): {
bb4 (cleanup): {
resume; // scope 0 at $DIR/uniform_array_move_out.rs:4:1: 7:2
}
}