Skip to content

Commit bfd7535

Browse files
committed
Fix wording on comment
1 parent 399796d commit bfd7535

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_typeck/src/check/check.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ fn detect_discriminant_duplicate<'tcx>(
15261526
}
15271527
None => {
15281528
// At this point we know this discriminant is a duplicate, and was not explicitly
1529-
// assigned by the user. Here we iterate backwards to fetch the hir for the last
1529+
// assigned by the user. Here we iterate backwards to fetch the HIR for the last
15301530
// explictly assigned discriminant, and letting the user know that this was the
15311531
// increment startpoint, and how many steps from there leading to the duplicate
15321532
if let Some((n, hir::Variant { span, ident, .. })) =
@@ -1549,12 +1549,12 @@ fn detect_discriminant_duplicate<'tcx>(
15491549
err.span_label(span, format!("{display_discr} assigned here"));
15501550
};
15511551

1552-
// Here we are looping through the discriminant vec, comparing each discriminant to oneanother.
1553-
// When a duplicate is detected, we instatiate an error and add a spanned note pointing to both
1554-
// initial and duplicate value. The duplicate discriminant is then discarded from the vec by swapping
1555-
// it with the last element and decrementing the vec.len by 1 (which is why we have to evaluate
1556-
// `discrs.len()` anew every iteration, and why this could be tricky to do in a functional style as
1557-
// we are mutating `discrs` on the fly).
1552+
// Here we are loop through the discriminants, comparing each discriminant to another.
1553+
// When a duplicate is detected, we instatiate an error and point to both
1554+
// initial and duplicate value. The duplicate discriminant is then discarded by swapping
1555+
// it with the last element and decrementing the `vec.len` (which is why we have to evaluate
1556+
// `discrs.len()` anew every iteration, and why this could be tricky to do in a functional
1557+
// style as we are mutating `discrs` on the fly).
15581558
let mut i = 0;
15591559
while i < discrs.len() {
15601560
let hir_var_i_idx = discrs[i].0.index();

0 commit comments

Comments
 (0)