Skip to content

Commit ebbaf46

Browse files
committed
simplify_try: address some of eddyb's comments
1 parent dc4242d commit ebbaf46

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_mir/transform/simplify_try.rs

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
5252
Some(x) => x,
5353
};
5454
if local_tmp_s0 != local_tmp_s1
55+
// Avoid moving into ourselves.
56+
|| local_0 == local_1
5557
// The field-and-variant information match up.
5658
|| vf_s0 != vf_s1
5759
// Source and target locals have the same type.
@@ -64,6 +66,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
6466
}
6567

6668
// Right shape; transform!
69+
s0.source_info = s2.source_info;
6770
match &mut s0.kind {
6871
StatementKind::Assign(box (place, rvalue)) => {
6972
*place = local_0.into();

0 commit comments

Comments
 (0)