@@ -80,7 +80,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
8080 . and_then ( |args| {
8181 args. args
8282 . iter ( )
83- . filter ( |arg| ! matches ! ( arg, GenericArg :: Lifetime ( _ ) ) )
83+ . filter ( |arg| arg. is_ty_or_const ( ) )
8484 . position ( |arg| arg. id ( ) == hir_id)
8585 } )
8686 . unwrap_or_else ( || {
@@ -113,7 +113,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
113113 . and_then ( |args| {
114114 args. args
115115 . iter ( )
116- . filter ( |arg| ! matches ! ( arg, GenericArg :: Lifetime ( _ ) ) )
116+ . filter ( |arg| arg. is_ty_or_const ( ) )
117117 . position ( |arg| arg. id ( ) == hir_id)
118118 } )
119119 . unwrap_or_else ( || {
@@ -169,7 +169,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
169169 . filter_map ( |seg| seg. args . map ( |args| ( args. args , seg) ) )
170170 . find_map ( |( args, seg) | {
171171 args. iter ( )
172- . filter ( |arg| ! matches ! ( arg, GenericArg :: Lifetime ( _ ) ) )
172+ . filter ( |arg| arg. is_ty_or_const ( ) )
173173 . position ( |arg| arg. id ( ) == hir_id)
174174 . map ( |index| ( index, seg) )
175175 } ) ;
@@ -232,12 +232,11 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
232232 } ;
233233
234234 debug ! ( ?parent_node) ;
235- debug ! ( ?generics) ;
236- debug ! ( ?arg_idx) ;
235+ debug ! ( ?generics, ?arg_idx) ;
237236 generics
238237 . params
239238 . iter ( )
240- . filter ( |param| ! matches ! ( param. kind, ty :: GenericParamDefKind :: Lifetime { .. } ) )
239+ . filter ( |param| param. kind . is_ty_or_const ( ) )
241240 . nth ( match generics. has_self && generics. parent . is_none ( ) {
242241 true => arg_idx + 1 ,
243242 false => arg_idx,
0 commit comments