1
Fork 0
This commit is contained in:
Michael Goulet 2022-10-15 17:49:32 +00:00
parent e994de803d
commit 4259f33305

View file

@ -578,18 +578,18 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
// region substs that are synthesized during AST lowering. These are substs // region substs that are synthesized during AST lowering. These are substs
// that are appended to the parent substs (trait and trait method). However, // that are appended to the parent substs (trait and trait method). However,
// we're trying to infer the unsubstituted type value of the RPITIT inside // we're trying to infer the unsubstituted type value of the RPITIT inside
// the *impl*, so we can later use the impl's method substitutions to normalize // the *impl*, so we can later use the impl's method substs to normalize
// an RPITIT to a concrete type. // an RPITIT to a concrete type (`confirm_impl_trait_in_trait_candidate`).
// //
// Due to the design of RPITITs, during AST lowering, we have no idea that // Due to the design of RPITITs, during AST lowering, we have no idea that
// an impl method is satisfying a trait method with RPITITs in it. Therefore, // an impl method corresponds to a trait method with RPITITs in it. Therefore,
// we don't have a list ofearly-bound region substs for the RPITIT in the impl. // we don't have a list of early-bound region substs for the RPITIT in the impl.
// Since early region parameters are index-based, we can't just rebase these // Since early region parameters are index-based, we can't just rebase these
// (trait method) early-bound region substs onto the impl, since region // (trait method) early-bound region substs onto the impl, and there's no
// parameters are index-based, and there's no guarantee that the indices from // guarantee that the indices from the trait substs and impl substs line up.
// the trait substs and impl substs line up -- so we subtract the number of // So to fix this, we subtract the number of trait substs and add the number of
// trait substs and add the number of impl substs to *renumber* these early- // impl substs to *renumber* these early-bound regions to their corresponding
// bound regions to their corresponding indices in the impl's substitutions list. // indices in the impl's substitutions list.
// //
// Also, we only need to account for a difference in trait and impl substs, // Also, we only need to account for a difference in trait and impl substs,
// since we previously enforce that the trait method and impl method have the // since we previously enforce that the trait method and impl method have the