Auto merge of #111752 - dingxiangfei2009:lower-or-pattern, r=cjgillot

Lower `Or` pattern without allocating place

cc `@azizghuloum` `@cjgillot`

Related to #111583 and #111644

While reviewing #111644, it occurs to me that while we directly lower conjunctive predicates, which are connected with `&&`, into the desirable control flow, today we don't directly lower the disjunctive predicates, which are connected with `||`, in the similar fashion. Instead, we allocate a place for the boolean temporary to hold the result of evaluating the `||` expression.

Usually I would expect optimization at later stages to "inline" the evaluation of boolean predicates into simple CFG, but #111583 is an example where `&&` is failing to be optimized away and the assembly shows that both the expensive operands are evaluated. Therefore, I would like to make a small change to make the CFG a bit more straight-forward without invoking the `as_temp` machinery, and plus avoid allocating the place to hold the boolean result as well.
This commit is contained in:
bors 2023-09-01 10:54:56 +00:00
commit f4555ef5e1
53 changed files with 1028 additions and 651 deletions

View File

@ -159,52 +159,44 @@ pub(crate) fn expr_into_dest(
}
}
ExprKind::LogicalOp { op, lhs, rhs } => {
// And:
//
// [block: If(lhs)] -true-> [else_block: dest = (rhs)]
// | (false)
// [shortcircuit_block: dest = false]
//
// Or:
//
// [block: If(lhs)] -false-> [else_block: dest = (rhs)]
// | (true)
// [shortcircuit_block: dest = true]
let (shortcircuit_block, mut else_block, join_block) = (
this.cfg.start_new_block(),
this.cfg.start_new_block(),
this.cfg.start_new_block(),
);
let lhs = unpack!(block = this.as_local_operand(block, &this.thir[lhs]));
let blocks = match op {
LogicalOp::And => (else_block, shortcircuit_block),
LogicalOp::Or => (shortcircuit_block, else_block),
let condition_scope = this.local_scope();
let source_info = this.source_info(expr.span);
// We first evaluate the left-hand side of the predicate ...
let (then_block, else_block) =
this.in_if_then_scope(condition_scope, expr.span, |this| {
this.then_else_break(
block,
&this.thir[lhs],
Some(condition_scope),
condition_scope,
source_info,
)
});
let (short_circuit, continuation, constant) = match op {
LogicalOp::And => (else_block, then_block, false),
LogicalOp::Or => (then_block, else_block, true),
};
let term = TerminatorKind::if_(lhs, blocks.0, blocks.1);
this.cfg.terminate(block, source_info, term);
// At this point, the control flow splits into a short-circuiting path
// and a continuation path.
// - If the operator is `&&`, passing `lhs` leads to continuation of evaluation on `rhs`;
// failing it leads to the short-circuting path which assigns `false` to the place.
// - If the operator is `||`, failing `lhs` leads to continuation of evaluation on `rhs`;
// passing it leads to the short-circuting path which assigns `true` to the place.
this.cfg.push_assign_constant(
shortcircuit_block,
short_circuit,
source_info,
destination,
Constant {
span: expr_span,
span: expr.span,
user_ty: None,
literal: match op {
LogicalOp::And => ConstantKind::from_bool(this.tcx, false),
LogicalOp::Or => ConstantKind::from_bool(this.tcx, true),
},
literal: ConstantKind::from_bool(this.tcx, constant),
},
);
this.cfg.goto(shortcircuit_block, source_info, join_block);
let rhs = unpack!(else_block = this.as_local_operand(else_block, &this.thir[rhs]));
this.cfg.push_assign(else_block, source_info, destination, Rvalue::Use(rhs));
this.cfg.goto(else_block, source_info, join_block);
join_block.unit()
let rhs = unpack!(this.expr_into_dest(destination, continuation, &this.thir[rhs]));
let target = this.cfg.start_new_block();
this.cfg.goto(rhs, source_info, target);
this.cfg.goto(short_circuit, source_info, target);
target.unit()
}
ExprKind::Loop { body } => {
// [block]

View File

@ -64,6 +64,43 @@ pub(crate) fn then_else_break(
rhs_then_block.unit()
}
ExprKind::LogicalOp { op: LogicalOp::Or, lhs, rhs } => {
let local_scope = this.local_scope();
let (lhs_success_block, failure_block) =
this.in_if_then_scope(local_scope, expr_span, |this| {
this.then_else_break(
block,
&this.thir[lhs],
temp_scope_override,
local_scope,
variable_source_info,
)
});
let rhs_success_block = unpack!(this.then_else_break(
failure_block,
&this.thir[rhs],
temp_scope_override,
break_scope,
variable_source_info,
));
this.cfg.goto(lhs_success_block, variable_source_info, rhs_success_block);
rhs_success_block.unit()
}
ExprKind::Unary { op: UnOp::Not, arg } => {
let local_scope = this.local_scope();
let (success_block, failure_block) =
this.in_if_then_scope(local_scope, expr_span, |this| {
this.then_else_break(
block,
&this.thir[arg],
temp_scope_override,
local_scope,
variable_source_info,
)
});
this.break_for_else(success_block, break_scope, variable_source_info);
failure_block.unit()
}
ExprKind::Scope { region_scope, lint_level, value } => {
let region_scope = (region_scope, this.source_info(expr_span));
this.in_scope(region_scope, lint_level, |this| {
@ -76,6 +113,13 @@ pub(crate) fn then_else_break(
)
})
}
ExprKind::Use { source } => this.then_else_break(
block,
&this.thir[source],
temp_scope_override,
break_scope,
variable_source_info,
),
ExprKind::Let { expr, ref pat } => this.lower_let_expr(
block,
&this.thir[expr],

View File

@ -22,9 +22,9 @@
// CHECK-LABEL: @chunks4_with_remainder
#[no_mangle]
pub fn chunks4_with_remainder(x: &[u8]) -> (&[[u8; 4]], &[u8]) {
// CHECK: and i64 %x.1, -4
// CHECK: and i64 %x.1, 3
// CHECK: lshr exact
// CHECK-DAG: and i64 %x.1, -4
// CHECK-DAG: and i64 %x.1, 3
// CHECK-DAG: lshr
// CHECK-NOT: mul
// CHECK-NOT: udiv
// CHECK-NOT: urem

View File

@ -100,13 +100,13 @@ pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
// CHECK-LABEL: @slice_iter_len
#[no_mangle]
pub fn slice_iter_len(it: &std::slice::Iter<'_, u32>) -> usize {
// CHECK: %[[START:.+]] = load ptr, ptr %it,
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
// CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
// CHECK: %[[START:.+]] = load ptr, ptr %it,
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
// CHECK: ptrtoint
// CHECK: ptrtoint

View File

@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(move _3, const true);
+ _2 = Not(move _3);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(const true, move _3);
+ _2 = Not(move _3);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(move _3, const false);
+ _2 = Not(move _3);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(const false, move _3);
+ _2 = Not(move _3);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -0,0 +1,39 @@
// compile-flags: -Z validate-mir
#![feature(let_chains)]
struct Droppy(u8);
impl Drop for Droppy {
fn drop(&mut self) {
println!("drop {}", self.0);
}
}
enum E {
A(u8),
B,
}
impl E {
fn f() -> Self {
Self::A(1)
}
}
fn always_true() -> bool {
true
}
// EMIT_MIR logical_or_in_conditional.test_or.built.after.mir
fn test_or() {
if Droppy(0).0 > 0 || Droppy(1).0 > 1 {}
}
// EMIT_MIR logical_or_in_conditional.test_complex.built.after.mir
fn test_complex() {
if let E::A(_) = E::f() && ((always_true() && Droppy(0).0 > 0) || Droppy(1).0 > 1) {}
if !always_true() && let E::B = E::f() {}
}
fn main() {
test_or();
}

View File

@ -0,0 +1,186 @@
// MIR for `test_complex` after built
fn test_complex() -> () {
let mut _0: ();
let _1: ();
let mut _2: E;
let mut _3: isize;
let mut _4: bool;
let mut _5: bool;
let mut _6: u8;
let mut _7: Droppy;
let mut _8: bool;
let mut _9: u8;
let mut _10: Droppy;
let mut _11: bool;
let mut _12: E;
let mut _13: isize;
bb0: {
StorageLive(_1);
StorageLive(_2);
_2 = E::f() -> [return: bb1, unwind: bb31];
}
bb1: {
FakeRead(ForMatchedPlace(None), _2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb2, otherwise: bb3];
}
bb2: {
falseEdge -> [real: bb4, imaginary: bb3];
}
bb3: {
goto -> bb19;
}
bb4: {
StorageLive(_4);
_4 = always_true() -> [return: bb5, unwind: bb31];
}
bb5: {
switchInt(move _4) -> [0: bb7, otherwise: bb6];
}
bb6: {
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
_7 = Droppy(const 0_u8);
_6 = (_7.0: u8);
_5 = Gt(move _6, const 0_u8);
switchInt(move _5) -> [0: bb9, otherwise: bb8];
}
bb7: {
goto -> bb13;
}
bb8: {
drop(_7) -> [return: bb10, unwind: bb31];
}
bb9: {
goto -> bb11;
}
bb10: {
StorageDead(_7);
StorageDead(_6);
goto -> bb16;
}
bb11: {
drop(_7) -> [return: bb12, unwind: bb31];
}
bb12: {
StorageDead(_7);
StorageDead(_6);
goto -> bb13;
}
bb13: {
StorageLive(_8);
StorageLive(_9);
StorageLive(_10);
_10 = Droppy(const 1_u8);
_9 = (_10.0: u8);
_8 = Gt(move _9, const 1_u8);
switchInt(move _8) -> [0: bb15, otherwise: bb14];
}
bb14: {
drop(_10) -> [return: bb16, unwind: bb31];
}
bb15: {
goto -> bb17;
}
bb16: {
StorageDead(_10);
StorageDead(_9);
_1 = const ();
goto -> bb20;
}
bb17: {
drop(_10) -> [return: bb18, unwind: bb31];
}
bb18: {
StorageDead(_10);
StorageDead(_9);
goto -> bb19;
}
bb19: {
_1 = const ();
goto -> bb20;
}
bb20: {
StorageDead(_8);
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
StorageLive(_11);
_11 = always_true() -> [return: bb21, unwind: bb31];
}
bb21: {
switchInt(move _11) -> [0: bb23, otherwise: bb22];
}
bb22: {
goto -> bb29;
}
bb23: {
goto -> bb24;
}
bb24: {
StorageLive(_12);
_12 = E::f() -> [return: bb25, unwind: bb31];
}
bb25: {
FakeRead(ForMatchedPlace(None), _12);
_13 = discriminant(_12);
switchInt(move _13) -> [1: bb27, otherwise: bb26];
}
bb26: {
goto -> bb29;
}
bb27: {
falseEdge -> [real: bb28, imaginary: bb26];
}
bb28: {
_0 = const ();
goto -> bb30;
}
bb29: {
_0 = const ();
goto -> bb30;
}
bb30: {
StorageDead(_11);
StorageDead(_12);
return;
}
bb31 (cleanup): {
resume;
}
}

View File

@ -0,0 +1,87 @@
// MIR for `test_or` after built
fn test_or() -> () {
let mut _0: ();
let mut _1: bool;
let mut _2: u8;
let mut _3: Droppy;
let mut _4: bool;
let mut _5: u8;
let mut _6: Droppy;
bb0: {
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
_3 = Droppy(const 0_u8);
_2 = (_3.0: u8);
_1 = Gt(move _2, const 0_u8);
switchInt(move _1) -> [0: bb2, otherwise: bb1];
}
bb1: {
drop(_3) -> [return: bb3, unwind: bb12];
}
bb2: {
goto -> bb4;
}
bb3: {
StorageDead(_3);
StorageDead(_2);
goto -> bb8;
}
bb4: {
drop(_3) -> [return: bb5, unwind: bb12];
}
bb5: {
StorageDead(_3);
StorageDead(_2);
StorageLive(_4);
StorageLive(_5);
StorageLive(_6);
_6 = Droppy(const 1_u8);
_5 = (_6.0: u8);
_4 = Gt(move _5, const 1_u8);
switchInt(move _4) -> [0: bb7, otherwise: bb6];
}
bb6: {
drop(_6) -> [return: bb8, unwind: bb12];
}
bb7: {
goto -> bb9;
}
bb8: {
StorageDead(_6);
StorageDead(_5);
_0 = const ();
goto -> bb11;
}
bb9: {
drop(_6) -> [return: bb10, unwind: bb12];
}
bb10: {
StorageDead(_6);
StorageDead(_5);
_0 = const ();
goto -> bb11;
}
bb11: {
StorageDead(_4);
StorageDead(_1);
return;
}
bb12 (cleanup): {
resume;
}
}

View File

@ -43,31 +43,33 @@
}
bb3: {
- StorageDead(_6);
- switchInt(move _5) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
- StorageDead(_6);
- _4 = const true;
- goto -> bb6;
- }
-
- bb5: {
- StorageDead(_6);
- _4 = const false;
- goto -> bb6;
- }
-
- bb6: {
- StorageDead(_5);
- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
- StorageDead(_5);
- _3 = const true;
- goto -> bb9;
- }
-
- bb8: {
- StorageDead(_5);
- _3 = const false;
- goto -> bb9;
- }

View File

@ -39,19 +39,20 @@
StorageLive(_4);
- _4 = _1;
- _3 = Eq(move _4, const 1_i32);
- switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ _4 = const 1_i32;
+ _3 = const true;
StorageDead(_4);
- switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ switchInt(const true) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_4);
_2 = const 2_i32;
goto -> bb3;
}
bb2: {
StorageDead(_4);
_2 = const 3_i32;
goto -> bb3;
}
@ -70,20 +71,21 @@
StorageLive(_9);
- _9 = _1;
- _8 = Eq(move _9, const 1_i32);
- switchInt(move _8) -> [0: bb5, otherwise: bb4];
+ _9 = const 1_i32;
+ _8 = const true;
StorageDead(_9);
- switchInt(move _8) -> [0: bb5, otherwise: bb4];
+ switchInt(const true) -> [0: bb5, otherwise: bb4];
}
bb4: {
StorageDead(_9);
- _7 = _1;
+ _7 = const 1_i32;
goto -> bb6;
}
bb5: {
StorageDead(_9);
StorageLive(_10);
_10 = _1;
_7 = Add(move _10, const 1_i32);

View File

@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(move _3, const true);
+ _2 = move _3;
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_i32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_i32;
goto -> bb3;
}

View File

@ -12,16 +12,17 @@
StorageLive(_3);
_3 = _1;
_2 = Eq(move _3, const -42f32);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_i32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_i32;
goto -> bb3;
}

View File

@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 'x');
- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
+ nop;
+ switchInt(move _3) -> [120: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_i8);
- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -14,40 +14,36 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_u32);
- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 0_u32;
goto -> bb6;
}
bb2: {
+ StorageDead(_3);
StorageDead(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = Ne(move _5, const 21_u32);
- StorageDead(_5);
- switchInt(move _4) -> [0: bb4, otherwise: bb3];
+ nop;
+ nop;
+ switchInt(move _5) -> [21: bb4, otherwise: bb3];
}
bb3: {
+ StorageDead(_5);
StorageDead(_5);
_0 = const 1_u32;
goto -> bb5;
}
bb4: {
+ StorageDead(_5);
StorageDead(_5);
_0 = const 2_u32;
goto -> bb5;
}

View File

@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const -42_i32);
- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
+ nop;
+ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_u32);
- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -18,11 +18,11 @@
StorageLive(_3);
_3 = _1;
_2 = Gt(move _3, const 0_i32);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
StorageLive(_4);
_4 = _1;
_0 = move _4 as u32 (IntToInt);
@ -32,6 +32,7 @@
}
bb2: {
StorageDead(_3);
StorageLive(_6);
- _6 = panic() -> unwind unreachable;
+ StorageLive(_7);

View File

@ -18,11 +18,11 @@
StorageLive(_3);
_3 = _1;
_2 = Gt(move _3, const 0_i32);
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
StorageLive(_4);
_4 = _1;
_0 = move _4 as u32 (IntToInt);
@ -32,6 +32,7 @@
}
bb2: {
StorageDead(_3);
StorageLive(_6);
- _6 = panic() -> unwind continue;
+ StorageLive(_7);

View File

@ -16,51 +16,49 @@ fn main() -> () {
let _8: &&[u8];
let _9: &&[u8; 4];
let mut _10: bool;
let mut _11: bool;
let mut _12: &&[u8];
let mut _13: &&[u8; 4];
let mut _14: !;
let _16: !;
let mut _17: core::panicking::AssertKind;
let mut _18: &&[u8];
let _19: &&[u8];
let mut _20: &&[u8; 4];
let _21: &&[u8; 4];
let mut _22: std::option::Option<std::fmt::Arguments<'_>>;
let _23: ();
let mut _24: (&&[u8], &&[u8; 4]);
let mut _25: &&[u8];
let _26: &[u8];
let mut _27: &&[u8; 4];
let _28: &[u8; 4];
let _29: &&[u8];
let _30: &&[u8; 4];
let mut _31: bool;
let mut _32: bool;
let mut _33: &&[u8];
let mut _34: &&[u8; 4];
let mut _35: !;
let _37: !;
let mut _38: core::panicking::AssertKind;
let mut _39: &&[u8];
let _40: &&[u8];
let mut _41: &&[u8; 4];
let _42: &&[u8; 4];
let mut _43: std::option::Option<std::fmt::Arguments<'_>>;
let mut _11: &&[u8];
let mut _12: &&[u8; 4];
let mut _13: !;
let _15: !;
let mut _16: core::panicking::AssertKind;
let mut _17: &&[u8];
let _18: &&[u8];
let mut _19: &&[u8; 4];
let _20: &&[u8; 4];
let mut _21: std::option::Option<std::fmt::Arguments<'_>>;
let _22: ();
let mut _23: (&&[u8], &&[u8; 4]);
let mut _24: &&[u8];
let _25: &[u8];
let mut _26: &&[u8; 4];
let _27: &[u8; 4];
let _28: &&[u8];
let _29: &&[u8; 4];
let mut _30: bool;
let mut _31: &&[u8];
let mut _32: &&[u8; 4];
let mut _33: !;
let _35: !;
let mut _36: core::panicking::AssertKind;
let mut _37: &&[u8];
let _38: &&[u8];
let mut _39: &&[u8; 4];
let _40: &&[u8; 4];
let mut _41: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug left_val => _8;
debug right_val => _9;
let _15: core::panicking::AssertKind;
let _14: core::panicking::AssertKind;
scope 2 {
debug kind => _15;
debug kind => _14;
}
}
scope 3 {
debug left_val => _29;
debug right_val => _30;
let _36: core::panicking::AssertKind;
debug left_val => _28;
debug right_val => _29;
let _34: core::panicking::AssertKind;
scope 4 {
debug kind => _36;
debug kind => _34;
}
}
@ -69,7 +67,7 @@ fn main() -> () {
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
_4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb19];
_4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21];
}
bb1: {
@ -90,179 +88,185 @@ fn main() -> () {
_9 = (_2.1: &&[u8; 4]);
StorageLive(_10);
StorageLive(_11);
_11 = &(*_8);
StorageLive(_12);
_12 = &(*_8);
StorageLive(_13);
_13 = &(*_9);
_11 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _12, move _13) -> [return: bb2, unwind: bb19];
_12 = &(*_9);
_10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21];
}
bb2: {
StorageDead(_13);
StorageDead(_12);
_10 = Not(move _11);
StorageDead(_11);
switchInt(move _10) -> [0: bb4, otherwise: bb3];
}
bb3: {
StorageLive(_15);
_15 = core::panicking::AssertKind::Eq;
FakeRead(ForLet(None), _15);
StorageLive(_16);
StorageLive(_17);
_17 = move _15;
StorageLive(_18);
StorageLive(_19);
_19 = &(*_8);
_18 = &(*_19);
StorageLive(_20);
StorageLive(_21);
_21 = &(*_9);
_20 = &(*_21);
StorageLive(_22);
_22 = Option::<Arguments<'_>>::None;
_16 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _17, move _18, move _20, move _22) -> bb19;
StorageDead(_12);
StorageDead(_11);
goto -> bb8;
}
bb4: {
goto -> bb7;
goto -> bb5;
}
bb5: {
StorageDead(_22);
StorageDead(_20);
StorageDead(_18);
StorageDead(_17);
StorageDead(_21);
StorageDead(_19);
StorageDead(_16);
StorageDead(_15);
unreachable;
StorageDead(_12);
StorageDead(_11);
StorageLive(_14);
_14 = core::panicking::AssertKind::Eq;
FakeRead(ForLet(None), _14);
StorageLive(_15);
StorageLive(_16);
_16 = move _14;
StorageLive(_17);
StorageLive(_18);
_18 = &(*_8);
_17 = &(*_18);
StorageLive(_19);
StorageLive(_20);
_20 = &(*_9);
_19 = &(*_20);
StorageLive(_21);
_21 = Option::<Arguments<'_>>::None;
_15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21;
}
bb6: {
goto -> bb8;
StorageDead(_21);
StorageDead(_19);
StorageDead(_17);
StorageDead(_16);
StorageDead(_20);
StorageDead(_18);
StorageDead(_15);
StorageDead(_14);
unreachable;
}
bb7: {
_1 = const ();
goto -> bb8;
goto -> bb9;
}
bb8: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
_1 = const ();
goto -> bb9;
}
bb9: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb10;
}
bb10: {
StorageDead(_7);
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
StorageLive(_22);
StorageLive(_23);
StorageLive(_24);
StorageLive(_25);
StorageLive(_26);
_26 = function_with_bytes::<&*b"AAAA">() -> [return: bb10, unwind: bb19];
}
bb10: {
_25 = &_26;
StorageLive(_27);
StorageLive(_28);
_28 = const b"AAAA";
_27 = &_28;
_24 = (move _25, move _27);
StorageDead(_27);
StorageDead(_25);
FakeRead(ForMatchedPlace(None), _24);
StorageLive(_29);
_29 = (_24.0: &&[u8]);
StorageLive(_30);
_30 = (_24.1: &&[u8; 4]);
StorageLive(_31);
StorageLive(_32);
StorageLive(_33);
_33 = &(*_29);
StorageLive(_34);
_34 = &(*_30);
_32 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _33, move _34) -> [return: bb11, unwind: bb19];
_25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21];
}
bb11: {
StorageDead(_34);
StorageDead(_33);
_31 = Not(move _32);
StorageDead(_32);
switchInt(move _31) -> [0: bb13, otherwise: bb12];
_24 = &_25;
StorageLive(_26);
StorageLive(_27);
_27 = const b"AAAA";
_26 = &_27;
_23 = (move _24, move _26);
StorageDead(_26);
StorageDead(_24);
FakeRead(ForMatchedPlace(None), _23);
StorageLive(_28);
_28 = (_23.0: &&[u8]);
StorageLive(_29);
_29 = (_23.1: &&[u8; 4]);
StorageLive(_30);
StorageLive(_31);
_31 = &(*_28);
StorageLive(_32);
_32 = &(*_29);
_30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21];
}
bb12: {
switchInt(move _30) -> [0: bb14, otherwise: bb13];
}
bb13: {
StorageDead(_32);
StorageDead(_31);
goto -> bb18;
}
bb14: {
goto -> bb15;
}
bb15: {
StorageDead(_32);
StorageDead(_31);
StorageLive(_34);
_34 = core::panicking::AssertKind::Eq;
FakeRead(ForLet(None), _34);
StorageLive(_35);
StorageLive(_36);
_36 = core::panicking::AssertKind::Eq;
FakeRead(ForLet(None), _36);
_36 = move _34;
StorageLive(_37);
StorageLive(_38);
_38 = move _36;
_38 = &(*_28);
_37 = &(*_38);
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
_39 = &(*_40);
StorageLive(_41);
StorageLive(_42);
_42 = &(*_30);
_41 = &(*_42);
StorageLive(_43);
_43 = Option::<Arguments<'_>>::None;
_37 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _38, move _39, move _41, move _43) -> bb19;
}
bb13: {
goto -> bb16;
}
bb14: {
StorageDead(_43);
StorageDead(_41);
StorageDead(_39);
StorageDead(_38);
StorageDead(_42);
StorageDead(_40);
StorageDead(_37);
StorageDead(_36);
unreachable;
}
bb15: {
goto -> bb17;
_41 = Option::<Arguments<'_>>::None;
_35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21;
}
bb16: {
_23 = const ();
goto -> bb17;
StorageDead(_41);
StorageDead(_39);
StorageDead(_37);
StorageDead(_36);
StorageDead(_40);
StorageDead(_38);
StorageDead(_35);
StorageDead(_34);
unreachable;
}
bb17: {
StorageDead(_31);
StorageDead(_30);
StorageDead(_29);
goto -> bb18;
goto -> bb19;
}
bb18: {
_22 = const ();
goto -> bb19;
}
bb19: {
StorageDead(_30);
StorageDead(_29);
StorageDead(_28);
StorageDead(_26);
StorageDead(_24);
goto -> bb20;
}
bb20: {
StorageDead(_27);
StorageDead(_25);
StorageDead(_23);
StorageDead(_22);
_0 = const ();
return;
}
bb19 (cleanup): {
bb21 (cleanup): {
resume;
}
}

View File

@ -32,12 +32,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
StorageDead(_5);
StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@ -52,6 +52,8 @@
}
bb4: {
StorageDead(_5);
StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}

View File

@ -32,12 +32,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
StorageDead(_5);
StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@ -52,6 +52,8 @@
}
bb4: {
StorageDead(_5);
StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}

View File

@ -35,12 +35,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
StorageDead(_5);
StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@ -55,6 +55,8 @@
}
bb4: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_11);
_11 = const 0_usize;
_12 = Len((*_2));

View File

@ -35,12 +35,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
StorageDead(_5);
StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@ -55,6 +55,8 @@
}
bb4: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_11);
_11 = const 0_usize;
_12 = Len((*_2));

View File

@ -28,12 +28,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
StorageDead(_5);
StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
@ -48,6 +48,8 @@
}
bb4: {
StorageDead(_5);
StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}

View File

@ -28,12 +28,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
StorageDead(_5);
StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
StorageDead(_5);
StorageDead(_4);
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
@ -48,6 +48,8 @@
}
bb4: {
StorageDead(_5);
StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}

View File

@ -40,39 +40,43 @@
- }
-
- bb3: {
+ StorageLive(_7);
+ _7 = move _6;
+ _5 = Ne(_7, const false);
+ StorageDead(_7);
StorageDead(_6);
- switchInt(move _5) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
+ StorageLive(_7);
+ _7 = move _6;
+ _5 = Ne(_7, const false);
+ StorageDead(_7);
+ StorageLive(_8);
+ _8 = move _5;
StorageDead(_6);
- _4 = const true;
- goto -> bb6;
- }
-
- bb5: {
- StorageDead(_6);
- _4 = const false;
- goto -> bb6;
- }
-
- bb6: {
+ StorageLive(_8);
+ _8 = move _5;
+ _4 = Ne(_8, const false);
+ StorageDead(_8);
StorageDead(_5);
- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
+ _4 = Ne(_8, const false);
+ StorageDead(_8);
+ StorageLive(_9);
+ _9 = move _4;
StorageDead(_5);
- _3 = const true;
- goto -> bb9;
- }
-
- bb8: {
- StorageDead(_5);
- _3 = const false;
- goto -> bb9;
- }
@ -82,8 +86,6 @@
- }
-
- bb10: {
+ StorageLive(_9);
+ _9 = move _4;
+ _3 = Ne(_9, const false);
+ StorageDead(_9);
+ StorageLive(_10);

View File

@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(move _3, const false);
+ _2 = move _3;
StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}

View File

@ -7,130 +7,111 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool {
let mut _3: u32;
let mut _4: u32;
let mut _5: bool;
let mut _6: bool;
let mut _6: u32;
let mut _7: u32;
let mut _8: u32;
let mut _9: bool;
let mut _10: bool;
let mut _11: u32;
let mut _8: bool;
let mut _9: u32;
let mut _10: u32;
let mut _11: bool;
let mut _12: u32;
let mut _13: bool;
let mut _13: u32;
let mut _14: bool;
let mut _15: u32;
let mut _16: u32;
let mut _17: bool;
let mut _18: u32;
let mut _19: u32;
let mut _20: bool;
bb0: {
StorageLive(_14);
StorageLive(_10);
StorageLive(_6);
StorageLive(_5);
StorageLive(_3);
_3 = ((*_1).0: u32);
StorageLive(_4);
_4 = ((*_2).0: u32);
_5 = Eq(move _3, move _4);
StorageDead(_4);
StorageDead(_3);
switchInt(move _5) -> [0: bb1, otherwise: bb2];
}
bb1: {
_6 = const false;
goto -> bb3;
StorageDead(_4);
StorageDead(_3);
goto -> bb8;
}
bb2: {
StorageLive(_9);
StorageLive(_7);
_7 = ((*_1).1: u32);
StorageDead(_4);
StorageDead(_3);
StorageLive(_8);
_8 = ((*_2).1: u32);
_9 = Eq(move _7, move _8);
StorageDead(_8);
StorageDead(_7);
_6 = move _9;
goto -> bb3;
StorageLive(_6);
_6 = ((*_1).1: u32);
StorageLive(_7);
_7 = ((*_2).1: u32);
_8 = Eq(move _6, move _7);
switchInt(move _8) -> [0: bb3, otherwise: bb4];
}
bb3: {
StorageDead(_9);
StorageDead(_5);
switchInt(move _6) -> [0: bb4, otherwise: bb5];
StorageDead(_7);
StorageDead(_6);
goto -> bb8;
}
bb4: {
_10 = const false;
goto -> bb6;
StorageDead(_7);
StorageDead(_6);
StorageLive(_11);
StorageLive(_9);
_9 = ((*_1).2: u32);
StorageLive(_10);
_10 = ((*_2).2: u32);
_11 = Eq(move _9, move _10);
switchInt(move _11) -> [0: bb5, otherwise: bb6];
}
bb5: {
StorageLive(_13);
StorageLive(_11);
_11 = ((*_1).2: u32);
StorageLive(_12);
_12 = ((*_2).2: u32);
_13 = Eq(move _11, move _12);
StorageDead(_12);
StorageDead(_11);
_10 = move _13;
goto -> bb6;
StorageDead(_10);
StorageDead(_9);
goto -> bb8;
}
bb6: {
StorageDead(_13);
StorageDead(_6);
switchInt(move _10) -> [0: bb7, otherwise: bb8];
StorageDead(_10);
StorageDead(_9);
StorageLive(_14);
StorageLive(_12);
_12 = ((*_1).3: u32);
StorageLive(_13);
_13 = ((*_2).3: u32);
_14 = Eq(move _12, move _13);
switchInt(move _14) -> [0: bb7, otherwise: bb9];
}
bb7: {
_14 = const false;
goto -> bb9;
StorageDead(_13);
StorageDead(_12);
goto -> bb8;
}
bb8: {
StorageLive(_17);
StorageLive(_15);
_15 = ((*_1).3: u32);
StorageLive(_16);
_16 = ((*_2).3: u32);
_17 = Eq(move _15, move _16);
StorageDead(_16);
StorageDead(_15);
_14 = move _17;
goto -> bb9;
_0 = const false;
goto -> bb10;
}
bb9: {
StorageDead(_17);
StorageDead(_10);
switchInt(move _14) -> [0: bb10, otherwise: bb11];
StorageDead(_13);
StorageDead(_12);
StorageLive(_15);
_15 = ((*_1).4: u32);
StorageLive(_16);
_16 = ((*_2).4: u32);
_0 = Eq(move _15, move _16);
StorageDead(_16);
StorageDead(_15);
goto -> bb10;
}
bb10: {
_0 = const false;
goto -> bb12;
}
bb11: {
StorageLive(_20);
StorageLive(_18);
_18 = ((*_1).4: u32);
StorageLive(_19);
_19 = ((*_2).4: u32);
_20 = Eq(move _18, move _19);
StorageDead(_19);
StorageDead(_18);
_0 = move _20;
goto -> bb12;
}
bb12: {
StorageDead(_20);
StorageDead(_14);
StorageDead(_11);
StorageDead(_8);
StorageDead(_5);
return;
}
}

View File

@ -27,12 +27,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_4);
_4 = ((*_2).0: u32);
_5 = Ne(move _3, move _4);
StorageDead(_4);
StorageDead(_3);
switchInt(move _5) -> [0: bb1, otherwise: bb10];
}
bb1: {
StorageDead(_4);
StorageDead(_3);
StorageDead(_5);
StorageLive(_8);
StorageLive(_6);
@ -40,12 +40,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_7);
_7 = ((*_2).1: u32);
_8 = Ne(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb9];
}
bb2: {
StorageDead(_7);
StorageDead(_6);
StorageDead(_8);
StorageLive(_11);
StorageLive(_9);
@ -53,12 +53,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_10);
_10 = ((*_2).2: u32);
_11 = Ne(move _9, move _10);
StorageDead(_10);
StorageDead(_9);
switchInt(move _11) -> [0: bb3, otherwise: bb8];
}
bb3: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_11);
StorageLive(_14);
StorageLive(_12);
@ -66,12 +66,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_13);
_13 = ((*_2).3: u32);
_14 = Ne(move _12, move _13);
StorageDead(_13);
StorageDead(_12);
switchInt(move _14) -> [0: bb4, otherwise: bb7];
}
bb4: {
StorageDead(_13);
StorageDead(_12);
StorageDead(_14);
StorageLive(_17);
StorageLive(_15);
@ -79,42 +79,52 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_16);
_16 = ((*_2).4: u32);
_17 = Ne(move _15, move _16);
StorageDead(_16);
StorageDead(_15);
switchInt(move _17) -> [0: bb5, otherwise: bb6];
}
bb5: {
StorageDead(_16);
StorageDead(_15);
StorageDead(_17);
_0 = const true;
goto -> bb11;
}
bb6: {
StorageDead(_16);
StorageDead(_15);
_0 = const false;
StorageDead(_17);
goto -> bb11;
}
bb7: {
StorageDead(_13);
StorageDead(_12);
_0 = const false;
StorageDead(_14);
goto -> bb11;
}
bb8: {
StorageDead(_10);
StorageDead(_9);
_0 = const false;
StorageDead(_11);
goto -> bb11;
}
bb9: {
StorageDead(_7);
StorageDead(_6);
_0 = const false;
StorageDead(_8);
goto -> bb11;
}
bb10: {
StorageDead(_4);
StorageDead(_3);
_0 = const false;
StorageDead(_5);
goto -> bb11;

View File

@ -40,16 +40,22 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
_5 = Eq(_4, const 1_isize);
_6 = Not(move _5);
StorageDead(_5);
StorageDead(_3);
StorageDead(_8);
switchInt(move _6) -> [0: bb3, otherwise: bb2];
switchInt(move _6) -> [0: bb2, otherwise: bb3];
}
bb2: {
assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb3, unwind continue];
StorageDead(_3);
StorageDead(_8);
goto -> bb4;
}
bb3: {
StorageDead(_3);
StorageDead(_8);
assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
}
bb4: {
StorageDead(_6);
StorageLive(_7);
_7 = _2 as u32 (IntToInt);

View File

@ -63,17 +63,19 @@ fn int_range(_1: usize, _2: usize) -> () {
_7 = Lt(move _5, move _6);
StorageDead(_6);
StorageDead(_5);
StorageDead(_16);
StorageDead(_15);
switchInt(move _7) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_16);
StorageDead(_15);
_8 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
StorageDead(_16);
StorageDead(_15);
_9 = (_4.0: usize);
StorageLive(_10);
_10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];

View File

@ -10,23 +10,53 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
scope 2 {
scope 3 {
debug result => _0;
scope 6 (inlined std::ptr::write::<u32>) {
scope 16 (inlined std::ptr::write::<u32>) {
debug dst => _1;
debug src => _2;
scope 7 {
scope 17 {
}
}
}
scope 4 (inlined std::ptr::read::<u32>) {
debug src => _1;
scope 5 {
scope 6 (inlined std::ptr::read::runtime::<u32>) {
debug src => _1;
scope 7 (inlined intrinsics::is_aligned_and_not_null::<u32>) {
debug ptr => _1;
scope 8 (inlined ptr::const_ptr::<impl *const u32>::is_null) {
debug self => _1;
let mut _3: *const u8;
scope 9 {
scope 10 (inlined ptr::const_ptr::<impl *const T>::is_null::runtime_impl) {
debug ptr => _3;
scope 11 (inlined ptr::const_ptr::<impl *const u8>::addr) {
debug self => _3;
scope 12 {
scope 13 (inlined ptr::const_ptr::<impl *const u8>::cast::<()>) {
debug self => _3;
}
}
}
}
}
}
scope 14 (inlined ptr::const_ptr::<impl *const u32>::is_aligned) {
debug self => _1;
scope 15 (inlined align_of::<u32>) {
}
}
}
}
}
}
}
}
bb0: {
StorageLive(_3);
_0 = (*_1);
StorageDead(_3);
(*_1) = _2;
return;
}

View File

@ -66,17 +66,19 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
StorageDead(_19);
StorageDead(_18);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_19);
StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
StorageDead(_19);
StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];

View File

@ -66,17 +66,19 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
StorageDead(_19);
StorageDead(_18);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_19);
StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
StorageDead(_19);
StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];

View File

@ -38,17 +38,19 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
_4 = Lt(move _2, move _3);
StorageDead(_3);
StorageDead(_2);
StorageDead(_8);
StorageDead(_7);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
StorageDead(_8);
StorageDead(_7);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
StorageDead(_8);
StorageDead(_7);
_5 = ((*_1).0: u32);
StorageLive(_6);
_6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable];

View File

@ -38,17 +38,19 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
_4 = Lt(move _2, move _3);
StorageDead(_3);
StorageDead(_2);
StorageDead(_8);
StorageDead(_7);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
StorageDead(_8);
StorageDead(_7);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
StorageDead(_8);
StorageDead(_7);
_5 = ((*_1).0: u32);
StorageLive(_6);
_6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue];

View File

@ -12,30 +12,27 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
let _10: &usize;
let _11: &usize;
let mut _16: bool;
let mut _17: bool;
let _18: &usize;
let mut _23: bool;
let _24: &usize;
let mut _29: bool;
let mut _30: bool;
let _31: &usize;
let mut _36: bool;
let _17: &usize;
let mut _22: bool;
let _23: &usize;
let mut _28: bool;
let _29: &usize;
let mut _34: &&usize;
let mut _35: &&usize;
let mut _36: &&usize;
let mut _37: &&usize;
let mut _38: &&usize;
let mut _39: &&usize;
let mut _40: &&usize;
let mut _41: &&usize;
let mut _42: &&usize;
let mut _43: &&usize;
let mut _44: &&usize;
scope 1 {
debug a => _4;
debug b => _6;
debug c => _8;
debug d => _10;
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _37;
debug other => _38;
debug self => _34;
debug other => _35;
let mut _12: &usize;
let mut _13: &usize;
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
@ -46,39 +43,39 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _41;
debug other => _42;
let mut _25: &usize;
let mut _26: &usize;
debug self => _36;
debug other => _37;
let mut _18: &usize;
let mut _19: &usize;
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _25;
debug other => _26;
let mut _27: usize;
let mut _28: usize;
debug self => _18;
debug other => _19;
let mut _20: usize;
let mut _21: usize;
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _39;
debug other => _40;
let mut _19: &usize;
let mut _20: &usize;
debug self => _38;
debug other => _39;
let mut _24: &usize;
let mut _25: &usize;
scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _19;
debug other => _20;
let mut _21: usize;
let mut _22: usize;
debug self => _24;
debug other => _25;
let mut _26: usize;
let mut _27: usize;
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _43;
debug other => _44;
let mut _32: &usize;
let mut _33: &usize;
debug self => _40;
debug other => _41;
let mut _30: &usize;
let mut _31: &usize;
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _32;
debug other => _33;
let mut _34: usize;
let mut _35: usize;
debug self => _30;
debug other => _31;
let mut _32: usize;
let mut _33: usize;
}
}
}
@ -96,10 +93,9 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
StorageLive(_10);
_9 = deref_copy (*_2);
_10 = &((*_9).3: usize);
StorageLive(_17);
StorageLive(_16);
StorageLive(_37);
StorageLive(_38);
StorageLive(_34);
StorageLive(_35);
StorageLive(_11);
_11 = _8;
_12 = deref_copy _4;
@ -111,109 +107,109 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
_16 = Le(move _14, move _15);
StorageDead(_15);
StorageDead(_14);
StorageDead(_11);
StorageDead(_38);
StorageDead(_37);
switchInt(move _16) -> [0: bb1, otherwise: bb2];
}
bb1: {
_17 = const false;
goto -> bb3;
StorageDead(_11);
StorageDead(_35);
StorageDead(_34);
goto -> bb4;
}
bb2: {
StorageLive(_23);
StorageLive(_39);
StorageLive(_40);
StorageLive(_18);
_18 = _6;
_19 = deref_copy _10;
_20 = deref_copy _18;
StorageDead(_11);
StorageDead(_35);
StorageDead(_34);
StorageLive(_22);
StorageLive(_36);
StorageLive(_37);
StorageLive(_17);
_17 = _6;
_18 = deref_copy _10;
_19 = deref_copy _17;
StorageLive(_20);
_20 = (*_18);
StorageLive(_21);
_21 = (*_19);
StorageLive(_22);
_22 = (*_20);
_23 = Le(move _21, move _22);
StorageDead(_22);
_22 = Le(move _20, move _21);
StorageDead(_21);
StorageDead(_18);
StorageDead(_40);
StorageDead(_39);
_17 = move _23;
goto -> bb3;
StorageDead(_20);
switchInt(move _22) -> [0: bb3, otherwise: bb8];
}
bb3: {
StorageDead(_23);
StorageDead(_16);
switchInt(move _17) -> [0: bb4, otherwise: bb8];
StorageDead(_17);
StorageDead(_37);
StorageDead(_36);
goto -> bb4;
}
bb4: {
StorageLive(_30);
StorageLive(_29);
StorageLive(_41);
StorageLive(_42);
StorageLive(_24);
_24 = _4;
_25 = deref_copy _8;
_26 = deref_copy _24;
StorageLive(_28);
StorageLive(_38);
StorageLive(_39);
StorageLive(_23);
_23 = _4;
_24 = deref_copy _8;
_25 = deref_copy _23;
StorageLive(_26);
_26 = (*_24);
StorageLive(_27);
_27 = (*_25);
StorageLive(_28);
_28 = (*_26);
_29 = Le(move _27, move _28);
StorageDead(_28);
_28 = Le(move _26, move _27);
StorageDead(_27);
StorageDead(_24);
StorageDead(_42);
StorageDead(_41);
switchInt(move _29) -> [0: bb5, otherwise: bb6];
StorageDead(_26);
switchInt(move _28) -> [0: bb5, otherwise: bb6];
}
bb5: {
_30 = const false;
StorageDead(_23);
StorageDead(_39);
StorageDead(_38);
_0 = const false;
goto -> bb7;
}
bb6: {
StorageLive(_36);
StorageLive(_43);
StorageLive(_44);
StorageLive(_31);
_31 = _10;
_32 = deref_copy _6;
_33 = deref_copy _31;
StorageLive(_34);
_34 = (*_32);
StorageLive(_35);
_35 = (*_33);
_36 = Le(move _34, move _35);
StorageDead(_35);
StorageDead(_34);
StorageDead(_31);
StorageDead(_44);
StorageDead(_43);
_30 = move _36;
StorageDead(_23);
StorageDead(_39);
StorageDead(_38);
StorageLive(_40);
StorageLive(_41);
StorageLive(_29);
_29 = _10;
_30 = deref_copy _6;
_31 = deref_copy _29;
StorageLive(_32);
_32 = (*_30);
StorageLive(_33);
_33 = (*_31);
_0 = Le(move _32, move _33);
StorageDead(_33);
StorageDead(_32);
StorageDead(_29);
StorageDead(_41);
StorageDead(_40);
goto -> bb7;
}
bb7: {
StorageDead(_36);
StorageDead(_29);
_0 = move _30;
StorageDead(_28);
goto -> bb9;
}
bb8: {
StorageDead(_17);
StorageDead(_37);
StorageDead(_36);
_0 = const true;
goto -> bb9;
}
bb9: {
StorageDead(_30);
StorageDead(_17);
StorageDead(_22);
StorageDead(_16);
StorageDead(_10);
StorageDead(_8);
StorageDead(_6);

View File

@ -13,9 +13,6 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41],
let mut _11: bool;
let mut _12: bool;
let mut _13: bool;
let mut _14: bool;
let mut _15: bool;
let mut _16: bool;
scope 1 {
debug a => _4;
debug b => _6;
@ -32,64 +29,46 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41],
_8 = ((*_7).2: usize);
_9 = deref_copy (*_2);
_10 = ((*_9).3: usize);
StorageLive(_12);
StorageLive(_11);
_11 = Le(_4, _8);
switchInt(move _11) -> [0: bb1, otherwise: bb2];
switchInt(move _11) -> [0: bb2, otherwise: bb1];
}
bb1: {
_12 = const false;
goto -> bb3;
StorageLive(_12);
_12 = Le(_10, _6);
switchInt(move _12) -> [0: bb2, otherwise: bb6];
}
bb2: {
StorageLive(_13);
_13 = Le(_10, _6);
_12 = move _13;
goto -> bb3;
_13 = Le(_8, _4);
switchInt(move _13) -> [0: bb3, otherwise: bb4];
}
bb3: {
StorageDead(_13);
StorageDead(_11);
switchInt(move _12) -> [0: bb4, otherwise: bb8];
_0 = const false;
goto -> bb5;
}
bb4: {
StorageLive(_15);
StorageLive(_14);
_14 = Le(_8, _4);
switchInt(move _14) -> [0: bb5, otherwise: bb6];
_0 = Le(_6, _10);
goto -> bb5;
}
bb5: {
_15 = const false;
StorageDead(_13);
goto -> bb7;
}
bb6: {
StorageLive(_16);
_16 = Le(_6, _10);
_15 = move _16;
_0 = const true;
goto -> bb7;
}
bb7: {
StorageDead(_16);
StorageDead(_14);
_0 = move _15;
goto -> bb9;
}
bb8: {
_0 = const true;
goto -> bb9;
}
bb9: {
StorageDead(_15);
StorageDead(_12);
StorageDead(_11);
return;
}
}

View File

@ -58,16 +58,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
StorageLive(_3);
_3 = Len((*_1));
_4 = Lt(_2, move _3);
StorageDead(_3);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
StorageDead(_3);
_0 = const Option::<&mut u32>::None;
goto -> bb3;
}
bb2: {
StorageDead(_3);
StorageLive(_8);
StorageLive(_5);
_5 = &raw mut (*_1);

View File

@ -58,16 +58,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
StorageLive(_3);
_3 = Len((*_1));
_4 = Lt(_2, move _3);
StorageDead(_3);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
StorageDead(_3);
_0 = const Option::<&mut u32>::None;
goto -> bb3;
}
bb2: {
StorageDead(_3);
StorageLive(_8);
StorageLive(_5);
_5 = &raw mut (*_1);

View File

@ -17,37 +17,50 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
let _14: usize;
let _15: usize;
let _16: usize;
scope 4 {
debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, };
debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, };
scope 5 {
let _6: usize;
scope 6 {
debug new_len => _6;
scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
debug self => _5;
}
scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
debug self => _7;
debug count => _3;
scope 9 {
scope 13 {
}
}
scope 10 (inlined slice_from_raw_parts_mut::<u32>) {
scope 14 (inlined slice_from_raw_parts_mut::<u32>) {
debug data => _8;
debug len => _6;
let mut _9: *mut ();
scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
debug self => _8;
}
scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
debug data_address => _9;
debug metadata => _6;
let mut _10: *const ();
let mut _11: std::ptr::metadata::PtrComponents<[u32]>;
let mut _12: std::ptr::metadata::PtrRepr<[u32]>;
scope 13 {
scope 17 {
}
}
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, };
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
let mut _14: *const [u32];
scope 9 (inlined std::ptr::metadata::<[u32]>) {
debug ptr => _14;
scope 10 {
}
}
}
@ -63,9 +76,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_4 = move (_2.1: usize);
StorageLive(_5);
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
StorageLive(_15);
StorageLive(_6);
StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@ -86,9 +100,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
StorageDead(_6);
StorageDead(_14);
StorageDead(_16);
StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
_0 = &mut (*_13);
return;

View File

@ -17,37 +17,50 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
let _14: usize;
let _15: usize;
let _16: usize;
scope 4 {
debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, };
debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, };
scope 5 {
let _6: usize;
scope 6 {
debug new_len => _6;
scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
debug self => _5;
}
scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
debug self => _7;
debug count => _3;
scope 9 {
scope 13 {
}
}
scope 10 (inlined slice_from_raw_parts_mut::<u32>) {
scope 14 (inlined slice_from_raw_parts_mut::<u32>) {
debug data => _8;
debug len => _6;
let mut _9: *mut ();
scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
debug self => _8;
}
scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
debug data_address => _9;
debug metadata => _6;
let mut _10: *const ();
let mut _11: std::ptr::metadata::PtrComponents<[u32]>;
let mut _12: std::ptr::metadata::PtrRepr<[u32]>;
scope 13 {
scope 17 {
}
}
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, };
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
let mut _14: *const [u32];
scope 9 (inlined std::ptr::metadata::<[u32]>) {
debug ptr => _14;
scope 10 {
}
}
}
@ -63,9 +76,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_4 = move (_2.1: usize);
StorageLive(_5);
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
StorageLive(_15);
StorageLive(_6);
StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@ -86,9 +100,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
StorageDead(_6);
StorageDead(_14);
StorageDead(_16);
StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
_0 = &mut (*_13);
return;

View File

@ -75,17 +75,19 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
StorageDead(_22);
StorageDead(_21);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_22);
StorageDead(_21);
_9 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
StorageDead(_22);
StorageDead(_21);
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];

View File

@ -75,17 +75,19 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
StorageDead(_22);
StorageDead(_21);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_22);
StorageDead(_21);
_9 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
StorageDead(_22);
StorageDead(_21);
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12];

View File

@ -19,17 +19,16 @@ fn array_casts() -> () {
let mut _18: &usize;
let _19: usize;
let mut _22: bool;
let mut _23: bool;
let mut _23: usize;
let mut _24: usize;
let mut _25: usize;
let mut _26: !;
let _28: !;
let mut _29: core::panicking::AssertKind;
let mut _30: &usize;
let _31: &usize;
let mut _32: &usize;
let _33: &usize;
let mut _34: std::option::Option<std::fmt::Arguments<'_>>;
let mut _25: !;
let _27: !;
let mut _28: core::panicking::AssertKind;
let mut _29: &usize;
let _30: &usize;
let mut _31: &usize;
let _32: &usize;
let mut _33: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug x => _1;
let _2: *mut usize;
@ -45,15 +44,15 @@ fn array_casts() -> () {
debug p => _9;
let _20: &usize;
let _21: &usize;
let mut _35: &usize;
let mut _34: &usize;
scope 6 {
}
scope 7 {
debug left_val => _20;
debug right_val => _21;
let _27: core::panicking::AssertKind;
let _26: core::panicking::AssertKind;
scope 8 {
debug kind => _27;
debug kind => _26;
}
}
}
@ -110,9 +109,9 @@ fn array_casts() -> () {
_15 = (*_16);
_14 = &_15;
StorageLive(_18);
_35 = const _;
Retag(_35);
_18 = &(*_35);
_34 = const _;
Retag(_34);
_18 = &(*_34);
_13 = (move _14, move _18);
Retag(_13);
StorageDead(_18);
@ -125,39 +124,16 @@ fn array_casts() -> () {
Retag(_21);
StorageLive(_22);
StorageLive(_23);
_23 = (*_20);
StorageLive(_24);
_24 = (*_20);
StorageLive(_25);
_25 = (*_21);
_23 = Eq(move _24, move _25);
StorageDead(_25);
StorageDead(_24);
_22 = Not(move _23);
StorageDead(_23);
_24 = (*_21);
_22 = Eq(move _23, move _24);
switchInt(move _22) -> [0: bb4, otherwise: bb3];
}
bb3: {
StorageLive(_27);
_27 = core::panicking::AssertKind::Eq;
StorageLive(_28);
StorageLive(_29);
_29 = move _27;
StorageLive(_30);
StorageLive(_31);
_31 = &(*_20);
_30 = &(*_31);
StorageLive(_32);
StorageLive(_33);
_33 = &(*_21);
_32 = &(*_33);
StorageLive(_34);
_34 = Option::<Arguments<'_>>::None;
Retag(_34);
_28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind unreachable;
}
bb4: {
StorageDead(_24);
StorageDead(_23);
_12 = const ();
StorageDead(_22);
StorageDead(_21);
@ -173,4 +149,26 @@ fn array_casts() -> () {
StorageDead(_1);
return;
}
bb4: {
StorageDead(_24);
StorageDead(_23);
StorageLive(_26);
_26 = core::panicking::AssertKind::Eq;
StorageLive(_27);
StorageLive(_28);
_28 = move _26;
StorageLive(_29);
StorageLive(_30);
_30 = &(*_20);
_29 = &(*_30);
StorageLive(_31);
StorageLive(_32);
_32 = &(*_21);
_31 = &(*_32);
StorageLive(_33);
_33 = Option::<Arguments<'_>>::None;
Retag(_33);
_27 = core::panicking::assert_failed::<usize, usize>(move _28, move _29, move _31, move _33) -> unwind unreachable;
}
}

View File

@ -19,17 +19,16 @@ fn array_casts() -> () {
let mut _18: &usize;
let _19: usize;
let mut _22: bool;
let mut _23: bool;
let mut _23: usize;
let mut _24: usize;
let mut _25: usize;
let mut _26: !;
let _28: !;
let mut _29: core::panicking::AssertKind;
let mut _30: &usize;
let _31: &usize;
let mut _32: &usize;
let _33: &usize;
let mut _34: std::option::Option<std::fmt::Arguments<'_>>;
let mut _25: !;
let _27: !;
let mut _28: core::panicking::AssertKind;
let mut _29: &usize;
let _30: &usize;
let mut _31: &usize;
let _32: &usize;
let mut _33: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug x => _1;
let _2: *mut usize;
@ -45,15 +44,15 @@ fn array_casts() -> () {
debug p => _9;
let _20: &usize;
let _21: &usize;
let mut _35: &usize;
let mut _34: &usize;
scope 6 {
}
scope 7 {
debug left_val => _20;
debug right_val => _21;
let _27: core::panicking::AssertKind;
let _26: core::panicking::AssertKind;
scope 8 {
debug kind => _27;
debug kind => _26;
}
}
}
@ -110,9 +109,9 @@ fn array_casts() -> () {
_15 = (*_16);
_14 = &_15;
StorageLive(_18);
_35 = const _;
Retag(_35);
_18 = &(*_35);
_34 = const _;
Retag(_34);
_18 = &(*_34);
_13 = (move _14, move _18);
Retag(_13);
StorageDead(_18);
@ -125,39 +124,16 @@ fn array_casts() -> () {
Retag(_21);
StorageLive(_22);
StorageLive(_23);
_23 = (*_20);
StorageLive(_24);
_24 = (*_20);
StorageLive(_25);
_25 = (*_21);
_23 = Eq(move _24, move _25);
StorageDead(_25);
StorageDead(_24);
_22 = Not(move _23);
StorageDead(_23);
_24 = (*_21);
_22 = Eq(move _23, move _24);
switchInt(move _22) -> [0: bb4, otherwise: bb3];
}
bb3: {
StorageLive(_27);
_27 = core::panicking::AssertKind::Eq;
StorageLive(_28);
StorageLive(_29);
_29 = move _27;
StorageLive(_30);
StorageLive(_31);
_31 = &(*_20);
_30 = &(*_31);
StorageLive(_32);
StorageLive(_33);
_33 = &(*_21);
_32 = &(*_33);
StorageLive(_34);
_34 = Option::<Arguments<'_>>::None;
Retag(_34);
_28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind continue;
}
bb4: {
StorageDead(_24);
StorageDead(_23);
_12 = const ();
StorageDead(_22);
StorageDead(_21);
@ -173,4 +149,26 @@ fn array_casts() -> () {
StorageDead(_1);
return;
}
bb4: {
StorageDead(_24);
StorageDead(_23);
StorageLive(_26);
_26 = core::panicking::AssertKind::Eq;
StorageLive(_27);
StorageLive(_28);
_28 = move _26;
StorageLive(_29);
StorageLive(_30);
_30 = &(*_20);
_29 = &(*_30);
StorageLive(_31);
StorageLive(_32);
_32 = &(*_21);
_31 = &(*_32);
StorageLive(_33);
_33 = Option::<Arguments<'_>>::None;
Retag(_33);
_27 = core::panicking::assert_failed::<usize, usize>(move _28, move _29, move _31, move _33) -> unwind continue;
}
}

View File

@ -32,7 +32,7 @@
^0
LL| |
LL| | if
LL| 1| !
LL| | !
LL| 1| is_true
LL| 0| {
LL| 0| a = 2

View File

@ -1,19 +1,18 @@
// check-pass
fn and_chain() {
let z;
if true && { z = 3; true} && z == 3 {}
//~^ ERROR E0381
}
fn and_chain_2() {
let z;
true && { z = 3; true} && z == 3;
//~^ ERROR E0381
}
fn or_chain() {
let z;
if false || { z = 3; false} || z == 3 {}
//~^ ERROR E0381
}
fn main() {

View File

@ -1,33 +0,0 @@
error[E0381]: used binding `z` is possibly-uninitialized
--> $DIR/chains-without-let.rs:3:34
|
LL | let z;
| - binding declared here but left uninitialized
LL | if true && { z = 3; true} && z == 3 {}
| ----- ^ `z` used here but it is possibly-uninitialized
| |
| binding initialized here in some conditions
error[E0381]: used binding `z` is possibly-uninitialized
--> $DIR/chains-without-let.rs:9:31
|
LL | let z;
| - binding declared here but left uninitialized
LL | true && { z = 3; true} && z == 3;
| ----- ^ `z` used here but it is possibly-uninitialized
| |
| binding initialized here in some conditions
error[E0381]: used binding `z` is possibly-uninitialized
--> $DIR/chains-without-let.rs:15:36
|
LL | let z;
| - binding declared here but left uninitialized
LL | if false || { z = 3; false} || z == 3 {}
| ----- ^ `z` used here but it is possibly-uninitialized
| |
| binding initialized here in some conditions
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0381`.