simplify_try: address some of eddyb's comments
This commit is contained in:
parent
dc4242d905
commit
ebbaf4611a
1 changed files with 3 additions and 0 deletions
|
@ -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.
|
||||
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue