Skip to content

Commit 78c0680

Browse files
committed
update comments
1 parent c6f2d49 commit 78c0680

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/rustc_mir/src/transform/early_otherwise_branch.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
283283
return None;
284284
}
285285

286-
// when one place is the projection of the other, it's not safe to calculate their discriminant values sequentially.
286+
// when the second place is a projection of the first one, it's not safe to calculate their discriminant values sequentially.
287287
// for example, this should not be optimized:
288288
//
289289
// ```rust
@@ -294,18 +294,17 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
294294
// ```mir
295295
// bb0: {
296296
// _2 = discriminant(*_1)
297-
// switchInt(move _2) -> [...]
297+
// switchInt(_2) -> [...]
298298
// }
299299
// bb1: {
300300
// _3 = discriminant(*(((*_1) as Some).0: &E))
301-
// switchInt(move _3) -> [...]
301+
// switchInt(_3) -> [...]
302302
// }
303303
// ```
304304
let discr_place = discr_info.place_of_adt_discr_read;
305305
let this_discr_place = this_bb_discr_info.place_of_adt_discr_read;
306306
if discr_place.local == this_discr_place.local
307-
&& (discr_place.projection.starts_with(this_discr_place.projection)
308-
|| this_discr_place.projection.starts_with(discr_place.projection))
307+
&& this_discr_place.projection.starts_with(discr_place.projection)
309308
{
310309
trace!("NO: one target is the projection of another");
311310
return None;

0 commit comments

Comments
 (0)