Rollup merge of #69051 - Centril:st-fixes, r=eddyb

simplify_try: address some of eddyb's comments

Addresses only https://github.com/rust-lang/rust/pull/66282#discussion_r376730986 and https://github.com/rust-lang/rust/pull/66282#discussion_r376730824.

r? @eddyb
cc @oli-obk
This commit is contained in:
Yuki Okushi 2020-02-15 07:17:49 +09:00 committed by GitHub
commit e0ea1e759f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();