@@ -1267,6 +1267,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
12671267 /// associated item, this function eliminates any traits which are a
12681268 /// supertrait of another candidate trait.
12691269 ///
1270+ /// This is the type-level analogue of
1271+ /// `rustc_hir_typeck::method::probe::ProbeContext::collapse_candidates_to_subtrait_pick`;
1272+ /// keep both implementations in sync.
1273+ ///
12701274 /// This implements RFC #3624.
12711275 fn collapse_candidates_to_subtrait_pick (
12721276 & self ,
@@ -1291,8 +1295,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
12911295 continue ;
12921296 }
12931297
1294- // This pick is not a supertrait of the `child_pick `.
1295- // Check if it's a subtrait of the `child_pick `, instead.
1298+ // This candidate is not a supertrait of the `child_trait `.
1299+ // Check if it's a subtrait of the `child_trait `, instead.
12961300 // If it is, then it must have been a subtrait of every
12971301 // other pick we've eliminated at this point. It will
12981302 // take over at this point.
@@ -1305,7 +1309,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13051309 continue ;
13061310 }
13071311
1308- // `child_pick` is not a supertrait of this pick.
1312+ // Neither `child_trait` or the current candidate are
1313+ // supertraits of each other.
13091314 // Don't bail here, since we may be comparing two supertraits
13101315 // of a common subtrait. These two supertraits won't be related
13111316 // at all, but we will pick them up next round when we find their
@@ -1318,7 +1323,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13181323 remaining_candidates = next_round;
13191324 } else {
13201325 // Otherwise, we must have at least two candidates which
1321- // are not related to each other at all.;
1326+ // are not related to each other at all.
13221327 return None ;
13231328 }
13241329 }
@@ -1362,8 +1367,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13621367 if let Some ( bound2) = matching_candidates. next ( ) {
13631368 let all_matching_candidates: Vec < _ > =
13641369 [ bound1, bound2] . into_iter ( ) . chain ( matching_candidates) . collect ( ) ;
1365- if let Some ( bound) =
1366- self . collapse_candidates_to_subtrait_pick ( & all_matching_candidates)
1370+ if let Some ( bound) = self . collapse_candidates_to_subtrait_pick ( & all_matching_candidates)
13671371 {
13681372 return Ok ( bound) ;
13691373 }
0 commit comments