lower ExprKind::Use, LogicalOp::Or and UnOp::Not

Co-authored-by: Abdulaziz Ghuloum <aghuloum@gmail.com>
This commit is contained in:
Ding Xiang Fei 2023-06-20 16:29:39 +08:00
parent b290d69738
commit e5453b4806
No known key found for this signature in database
GPG Key ID: 3CD748647EEF6359
31 changed files with 508 additions and 458 deletions

View File

@ -64,6 +64,43 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
rhs_then_block.unit() 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 } => { ExprKind::Scope { region_scope, lint_level, value } => {
let region_scope = (region_scope, this.source_info(expr_span)); let region_scope = (region_scope, this.source_info(expr_span));
this.in_scope(region_scope, lint_level, |this| { this.in_scope(region_scope, lint_level, |this| {
@ -76,6 +113,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
) )
}) })
} }
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( ExprKind::Let { expr, ref pat } => this.lower_let_expr(
block, block,
&this.thir[expr], &this.thir[expr],

View File

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

View File

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

View File

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

View File

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

View File

@ -7,22 +7,19 @@ fn test_complex() -> () {
let mut _3: isize; let mut _3: isize;
let mut _4: bool; let mut _4: bool;
let mut _5: bool; let mut _5: bool;
let mut _6: bool; let mut _6: u8;
let mut _7: bool; let mut _7: Droppy;
let mut _8: u8; let mut _8: bool;
let mut _9: Droppy; let mut _9: u8;
let mut _10: bool; let mut _10: Droppy;
let mut _11: u8; let mut _11: bool;
let mut _12: Droppy; let mut _12: E;
let mut _13: bool; let mut _13: isize;
let mut _14: bool;
let mut _15: E;
let mut _16: isize;
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
StorageLive(_2); StorageLive(_2);
_2 = E::f() -> [return: bb1, unwind: bb27]; _2 = E::f() -> [return: bb1, unwind: bb31];
} }
bb1: { bb1: {
@ -36,145 +33,154 @@ fn test_complex() -> () {
} }
bb3: { bb3: {
goto -> bb16; goto -> bb19;
} }
bb4: { bb4: {
StorageLive(_4); StorageLive(_4);
StorageLive(_5); _4 = always_true() -> [return: bb5, unwind: bb31];
StorageLive(_6);
_6 = always_true() -> [return: bb11, unwind: bb27];
} }
bb5: { bb5: {
_4 = const true; switchInt(move _4) -> [0: bb7, otherwise: bb6];
goto -> bb7;
} }
bb6: { bb6: {
StorageLive(_10); StorageLive(_5);
StorageLive(_11); StorageLive(_6);
StorageLive(_12); StorageLive(_7);
_12 = Droppy(const 1_u8); _7 = Droppy(const 0_u8);
_11 = (_12.0: u8); _6 = (_7.0: u8);
_10 = Gt(move _11, const 1_u8); _5 = Gt(move _6, const 0_u8);
drop(_12) -> [return: bb13, unwind: bb27]; switchInt(move _5) -> [0: bb9, otherwise: bb8];
} }
bb7: { bb7: {
StorageDead(_10); goto -> bb13;
StorageDead(_5);
switchInt(move _4) -> [0: bb15, otherwise: bb14];
} }
bb8: { bb8: {
_5 = const false; drop(_7) -> [return: bb10, unwind: bb31];
goto -> bb10;
} }
bb9: { bb9: {
StorageLive(_7); goto -> bb11;
StorageLive(_8);
StorageLive(_9);
_9 = Droppy(const 0_u8);
_8 = (_9.0: u8);
_7 = Gt(move _8, const 0_u8);
drop(_9) -> [return: bb12, unwind: bb27];
} }
bb10: { bb10: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
switchInt(move _5) -> [0: bb6, otherwise: bb5];
}
bb11: {
switchInt(move _6) -> [0: bb8, otherwise: bb9];
}
bb12: {
StorageDead(_9);
StorageDead(_8);
_5 = move _7;
goto -> bb10;
}
bb13: {
StorageDead(_12);
StorageDead(_11);
_4 = move _10;
goto -> bb7;
}
bb14: {
_1 = const ();
goto -> bb17;
}
bb15: {
goto -> bb16; goto -> bb16;
} }
bb16: { bb11: {
_1 = const (); 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; goto -> bb17;
} }
bb16: {
StorageDead(_10);
StorageDead(_9);
_1 = const ();
goto -> bb20;
}
bb17: { bb17: {
StorageDead(_4); drop(_10) -> [return: bb18, unwind: bb31];
StorageDead(_2);
StorageDead(_1);
StorageLive(_13);
StorageLive(_14);
_14 = always_true() -> [return: bb18, unwind: bb27];
} }
bb18: { bb18: {
_13 = Not(move _14); StorageDead(_10);
StorageDead(_14); StorageDead(_9);
switchInt(move _13) -> [0: bb20, otherwise: bb19]; goto -> bb19;
} }
bb19: { bb19: {
StorageLive(_15); _1 = const ();
_15 = E::f() -> [return: bb21, unwind: bb27]; goto -> bb20;
} }
bb20: { bb20: {
goto -> bb25; StorageDead(_8);
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
StorageLive(_11);
_11 = always_true() -> [return: bb21, unwind: bb31];
} }
bb21: { bb21: {
FakeRead(ForMatchedPlace(None), _15); switchInt(move _11) -> [0: bb23, otherwise: bb22];
_16 = discriminant(_15);
switchInt(move _16) -> [1: bb23, otherwise: bb22];
} }
bb22: { bb22: {
goto -> bb25; goto -> bb29;
} }
bb23: { bb23: {
falseEdge -> [real: bb24, imaginary: bb22]; goto -> bb24;
} }
bb24: { bb24: {
_0 = const (); StorageLive(_12);
goto -> bb26; _12 = E::f() -> [return: bb25, unwind: bb31];
} }
bb25: { bb25: {
_0 = const (); FakeRead(ForMatchedPlace(None), _12);
goto -> bb26; _13 = discriminant(_12);
switchInt(move _13) -> [1: bb27, otherwise: bb26];
} }
bb26: { bb26: {
StorageDead(_13); goto -> bb29;
StorageDead(_15); }
bb27: {
falseEdge -> [real: bb28, imaginary: bb26];
}
bb28: {
_0 = const ();
goto -> bb30;
}
bb29: {
_0 = const ();
goto -> bb30;
}
bb30: {
StorageDead(_11);
StorageDead(_12);
return; return;
} }
bb27 (cleanup): { bb31 (cleanup): {
resume; resume;
} }
} }

View File

@ -3,78 +3,85 @@
fn test_or() -> () { fn test_or() -> () {
let mut _0: (); let mut _0: ();
let mut _1: bool; let mut _1: bool;
let mut _2: bool; let mut _2: u8;
let mut _3: u8; let mut _3: Droppy;
let mut _4: Droppy; let mut _4: bool;
let mut _5: bool; let mut _5: u8;
let mut _6: u8; let mut _6: Droppy;
let mut _7: Droppy;
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
StorageLive(_2); StorageLive(_2);
StorageLive(_3); StorageLive(_3);
StorageLive(_4); _3 = Droppy(const 0_u8);
_4 = Droppy(const 0_u8); _2 = (_3.0: u8);
_3 = (_4.0: u8); _1 = Gt(move _2, const 0_u8);
_2 = Gt(move _3, const 0_u8); switchInt(move _1) -> [0: bb2, otherwise: bb1];
drop(_4) -> [return: bb4, unwind: bb10];
} }
bb1: { bb1: {
_1 = const true; drop(_3) -> [return: bb3, unwind: bb12];
goto -> bb3;
} }
bb2: { bb2: {
StorageLive(_5); goto -> bb4;
StorageLive(_6);
StorageLive(_7);
_7 = Droppy(const 1_u8);
_6 = (_7.0: u8);
_5 = Gt(move _6, const 1_u8);
drop(_7) -> [return: bb5, unwind: bb10];
} }
bb3: { bb3: {
StorageDead(_5);
StorageDead(_2);
switchInt(move _1) -> [0: bb7, otherwise: bb6];
}
bb4: {
StorageDead(_4);
StorageDead(_3); StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1]; StorageDead(_2);
}
bb5: {
StorageDead(_7);
StorageDead(_6);
_1 = move _5;
goto -> bb3;
}
bb6: {
_0 = const ();
goto -> bb9;
}
bb7: {
goto -> bb8; goto -> bb8;
} }
bb8: { bb4: {
_0 = const (); 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; goto -> bb9;
} }
bb8: {
StorageDead(_6);
StorageDead(_5);
_0 = const ();
goto -> bb11;
}
bb9: { bb9: {
drop(_6) -> [return: bb10, unwind: bb12];
}
bb10: {
StorageDead(_6);
StorageDead(_5);
_0 = const ();
goto -> bb11;
}
bb11: {
StorageDead(_4);
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb10 (cleanup): { bb12 (cleanup): {
resume; resume;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

@ -1,7 +1,6 @@
fn and_chain() { fn and_chain() {
let z; let z;
if true && { z = 3; true} && z == 3 {} if true && { z = 3; true} && z == 3 {}
//~^ ERROR E0381
} }
fn and_chain_2() { fn and_chain_2() {
@ -13,7 +12,6 @@ fn and_chain_2() {
fn or_chain() { fn or_chain() {
let z; let z;
if false || { z = 3; false} || z == 3 {} if false || { z = 3; false} || z == 3 {}
//~^ ERROR E0381
} }
fn main() { fn main() {

View File

@ -1,15 +1,5 @@
error[E0381]: used binding `z` is possibly-uninitialized error[E0381]: used binding `z` is possibly-uninitialized
--> $DIR/chains-without-let.rs:3:34 --> $DIR/chains-without-let.rs:8:31
|
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; LL | let z;
| - binding declared here but left uninitialized | - binding declared here but left uninitialized
@ -18,16 +8,6 @@ LL | true && { z = 3; true} && z == 3;
| | | |
| binding initialized here in some conditions | binding initialized here in some conditions
error[E0381]: used binding `z` is possibly-uninitialized error: aborting due to previous error
--> $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`. For more information about this error, try `rustc --explain E0381`.