about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChenguang Wang <w3cing@gmail.com>2020-12-09 19:50:11 -0800
committerChenguang Wang <w3cing@gmail.com>2020-12-09 19:50:11 -0800
commit78c0680b3febef5aaa2330d8b0a7879fd44e9eba (patch)
treed919b016c79fabbd545e8c5f38aae8dc975e463b
parentc6f2d49ff8be6b42bba94e7dc96e0fff8b5ca580 (diff)
downloadrust-78c0680b3febef5aaa2330d8b0a7879fd44e9eba.tar.gz
rust-78c0680b3febef5aaa2330d8b0a7879fd44e9eba.zip
update comments
-rw-r--r--compiler/rustc_mir/src/transform/early_otherwise_branch.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs
index 5829c522935..f28a4b46715 100644
--- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs
+++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs
@@ -283,7 +283,7 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
                 return None;
             }
 
-            // when one place is the projection of the other, it's not safe to calculate their discriminant values sequentially.
+            // when the second place is a projection of the first one, it's not safe to calculate their discriminant values sequentially.
             // for example, this should not be optimized:
             //
             // ```rust
@@ -294,18 +294,17 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
             // ```mir
             // bb0: {
             //   _2 = discriminant(*_1)
-            //   switchInt(move _2) -> [...]
+            //   switchInt(_2) -> [...]
             // }
             // bb1: {
             //   _3 = discriminant(*(((*_1) as Some).0: &E))
-            //   switchInt(move _3) -> [...]
+            //   switchInt(_3) -> [...]
             // }
             // ```
             let discr_place = discr_info.place_of_adt_discr_read;
             let this_discr_place = this_bb_discr_info.place_of_adt_discr_read;
             if discr_place.local == this_discr_place.local
-                && (discr_place.projection.starts_with(this_discr_place.projection)
-                    || this_discr_place.projection.starts_with(discr_place.projection))
+                && this_discr_place.projection.starts_with(discr_place.projection)
             {
                 trace!("NO: one target is the projection of another");
                 return None;