Skip to content

Commit

Permalink
simplify_try: address some of eddyb's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Feb 11, 2020
1 parent dc4242d commit ebbaf46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc_mir/transform/simplify_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
Some(x) => x,
};
if local_tmp_s0 != local_tmp_s1
// Avoid moving into ourselves.
|| local_0 == local_1
// The field-and-variant information match up.
|| vf_s0 != vf_s1
// Source and target locals have the same type.
Expand All @@ -64,6 +66,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
}

// Right shape; transform!
s0.source_info = s2.source_info;
match &mut s0.kind {
StatementKind::Assign(box (place, rvalue)) => {
*place = local_0.into();
Expand Down

0 comments on commit ebbaf46

Please sign in to comment.