@@ -32,7 +32,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
3232 // This matches on types who's paths couldn't be resolved without typeck'ing e.g.
3333 //
3434 // trait Foo {
35- // type Assoc<const N1: usize>;;
35+ // type Assoc<const N1: usize>;
3636 // fn foo() -> Self::Assoc<3>;
3737 // // note: if the def_id argument is the 3 then in this example
3838 // // parent_node would be the node for Self::Assoc<_>
@@ -41,7 +41,8 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
4141 // I believe this match arm is only needed for GAT but I am not 100% sure - BoxyUwU
4242 Node :: Ty ( hir_ty @ Ty { kind : TyKind :: Path ( QPath :: TypeRelative ( _, segment) ) , .. } ) => {
4343 // Walk up from the parent_node to find an item so that
44- // we can resolve the relative path to an actual associated type
44+ // we can resolve the relative path to an actual associated type.
45+ // For the code example above this item would be the Foo trait.
4546 let item_hir_id = tcx
4647 . hir ( )
4748 . parent_iter ( hir_id)
@@ -53,7 +54,8 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
5354 let item_ctxt = & ItemCtxt :: new ( tcx, item_did) as & dyn crate :: astconv:: AstConv < ' _ > ;
5455
5556 // This ty will be the actual associated type so that we can
56- // go through its generics to find which param our def_id corresponds to
57+ // go through its generics to find which param our def_id corresponds to.
58+ // For the code example above, this ty would be the Assoc<const N1: usize>.
5759 let ty = item_ctxt. ast_ty_to_ty ( hir_ty) ;
5860 if let ty:: Projection ( projection) = ty. kind ( ) {
5961 let generics = tcx. generics_of ( projection. item_def_id ) ;
0 commit comments