@@ -313,7 +313,7 @@ pub enum ExplicitLateBound {
313313 No ,
314314}
315315
316- #[ derive( Copy , Clone , PartialEq ) ]
316+ #[ derive( Debug , Copy , Clone , PartialEq ) ]
317317pub enum IsMethodCall {
318318 Yes ,
319319 No ,
@@ -324,8 +324,7 @@ pub enum IsMethodCall {
324324#[ derive( Debug , Copy , Clone , PartialEq ) ]
325325pub ( crate ) enum GenericArgPosition {
326326 Type ,
327- Value , // e.g., functions
328- MethodCall ,
327+ Call ( IsMethodCall ) ,
329328}
330329
331330/// Whether to allow duplicate associated iten constraints in a trait ref, e.g.
@@ -556,14 +555,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
556555 def_id : DefId ,
557556 item_segment : & hir:: PathSegment < ' tcx > ,
558557 ) -> GenericArgsRef < ' tcx > {
559- let ( args, _) = self . lower_generic_args_of_path (
560- span,
561- def_id,
562- & [ ] ,
563- item_segment,
564- None ,
565- GenericArgPosition :: Type ,
566- ) ;
558+ let ( args, _) = self . lower_generic_args_of_path ( span, def_id, & [ ] , item_segment, None ) ;
567559 if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
568560 prohibit_assoc_item_constraint ( self , c, Some ( ( def_id, item_segment, span) ) ) ;
569561 }
@@ -612,7 +604,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
612604 parent_args : & [ ty:: GenericArg < ' tcx > ] ,
613605 segment : & hir:: PathSegment < ' tcx > ,
614606 self_ty : Option < Ty < ' tcx > > ,
615- pos : GenericArgPosition ,
616607 ) -> ( GenericArgsRef < ' tcx > , GenericArgCountResult ) {
617608 // If the type is parameterized by this region, then replace this
618609 // region with the current anon region binding (in other words,
@@ -635,8 +626,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
635626 assert ! ( self_ty. is_none( ) ) ;
636627 }
637628
638- let arg_count =
639- check_generic_arg_count ( self , def_id, segment, generics, pos, self_ty. is_some ( ) ) ;
629+ let arg_count = check_generic_arg_count (
630+ self ,
631+ def_id,
632+ segment,
633+ generics,
634+ GenericArgPosition :: Type ,
635+ self_ty. is_some ( ) ,
636+ ) ;
640637
641638 // Skip processing if type has no generic parameters.
642639 // Traits always have `Self` as a generic parameter, which means they will not return early
@@ -821,14 +818,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
821818 item_segment : & hir:: PathSegment < ' tcx > ,
822819 parent_args : GenericArgsRef < ' tcx > ,
823820 ) -> GenericArgsRef < ' tcx > {
824- let ( args, _) = self . lower_generic_args_of_path (
825- span,
826- item_def_id,
827- parent_args,
828- item_segment,
829- None ,
830- GenericArgPosition :: Type ,
831- ) ;
821+ let ( args, _) =
822+ self . lower_generic_args_of_path ( span, item_def_id, parent_args, item_segment, None ) ;
832823 if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
833824 prohibit_assoc_item_constraint ( self , c, Some ( ( item_def_id, item_segment, span) ) ) ;
834825 }
@@ -940,7 +931,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
940931 & [ ] ,
941932 segment,
942933 Some ( self_ty) ,
943- GenericArgPosition :: Type ,
944934 ) ;
945935
946936 let constraints = segment. args ( ) . constraints ;
@@ -1116,14 +1106,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
11161106 ) -> ty:: TraitRef < ' tcx > {
11171107 self . report_internal_fn_trait ( span, trait_def_id, trait_segment, is_impl) ;
11181108
1119- let ( generic_args, _) = self . lower_generic_args_of_path (
1120- span,
1121- trait_def_id,
1122- & [ ] ,
1123- trait_segment,
1124- Some ( self_ty) ,
1125- GenericArgPosition :: Type ,
1126- ) ;
1109+ let ( generic_args, _) =
1110+ self . lower_generic_args_of_path ( span, trait_def_id, & [ ] , trait_segment, Some ( self_ty) ) ;
11271111 if let Some ( c) = trait_segment. args ( ) . constraints . first ( ) {
11281112 prohibit_assoc_item_constraint ( self , c, Some ( ( trait_def_id, trait_segment, span) ) ) ;
11291113 }
0 commit comments