@@ -32,7 +32,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
32
32
// This matches on types who's paths couldn't be resolved without typeck'ing e.g.
33
33
//
34
34
// trait Foo {
35
- // type Assoc<const N1: usize>;;
35
+ // type Assoc<const N1: usize>;
36
36
// fn foo() -> Self::Assoc<3>;
37
37
// // note: if the def_id argument is the 3 then in this example
38
38
// // 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<
41
41
// I believe this match arm is only needed for GAT but I am not 100% sure - BoxyUwU
42
42
Node :: Ty ( hir_ty @ Ty { kind : TyKind :: Path ( QPath :: TypeRelative ( _, segment) ) , .. } ) => {
43
43
// 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.
45
46
let item_hir_id = tcx
46
47
. hir ( )
47
48
. parent_iter ( hir_id)
@@ -53,7 +54,8 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
53
54
let item_ctxt = & ItemCtxt :: new ( tcx, item_did) as & dyn crate :: astconv:: AstConv < ' _ > ;
54
55
55
56
// 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>.
57
59
let ty = item_ctxt. ast_ty_to_ty ( hir_ty) ;
58
60
if let ty:: Projection ( projection) = ty. kind ( ) {
59
61
let generics = tcx. generics_of ( projection. item_def_id ) ;
0 commit comments