@@ -318,7 +318,7 @@ pub enum ExplicitLateBound {
318318 No ,
319319}
320320
321- #[ derive( Copy , Clone , PartialEq ) ]
321+ #[ derive( Debug , Copy , Clone , PartialEq ) ]
322322pub enum IsMethodCall {
323323 Yes ,
324324 No ,
@@ -329,8 +329,7 @@ pub enum IsMethodCall {
329329#[ derive( Debug , Copy , Clone , PartialEq ) ]
330330pub ( crate ) enum GenericArgPosition {
331331 Type ,
332- Value , // e.g., functions
333- MethodCall ,
332+ Value ( IsMethodCall ) ,
334333}
335334
336335/// Whether to allow duplicate associated iten constraints in a trait ref, e.g.
@@ -561,14 +560,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
561560 def_id : DefId ,
562561 item_segment : & hir:: PathSegment < ' tcx > ,
563562 ) -> GenericArgsRef < ' tcx > {
564- let ( args, _) = self . lower_generic_args_of_path (
565- span,
566- def_id,
567- & [ ] ,
568- item_segment,
569- None ,
570- GenericArgPosition :: Type ,
571- ) ;
563+ let ( args, _) = self . lower_generic_args_of_path ( span, def_id, & [ ] , item_segment, None ) ;
572564 if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
573565 prohibit_assoc_item_constraint ( self , c, Some ( ( def_id, item_segment, span) ) ) ;
574566 }
@@ -617,7 +609,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
617609 parent_args : & [ ty:: GenericArg < ' tcx > ] ,
618610 segment : & hir:: PathSegment < ' tcx > ,
619611 self_ty : Option < Ty < ' tcx > > ,
620- pos : GenericArgPosition ,
621612 ) -> ( GenericArgsRef < ' tcx > , GenericArgCountResult ) {
622613 // If the type is parameterized by this region, then replace this
623614 // region with the current anon region binding (in other words,
@@ -640,8 +631,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
640631 assert ! ( self_ty. is_none( ) ) ;
641632 }
642633
643- let arg_count =
644- check_generic_arg_count ( self , def_id, segment, generics, pos, self_ty. is_some ( ) ) ;
634+ let arg_count = check_generic_arg_count (
635+ self ,
636+ def_id,
637+ segment,
638+ generics,
639+ GenericArgPosition :: Type ,
640+ self_ty. is_some ( ) ,
641+ ) ;
645642
646643 // Skip processing if type has no generic parameters.
647644 // Traits always have `Self` as a generic parameter, which means they will not return early
@@ -826,14 +823,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
826823 item_segment : & hir:: PathSegment < ' tcx > ,
827824 parent_args : GenericArgsRef < ' tcx > ,
828825 ) -> GenericArgsRef < ' tcx > {
829- let ( args, _) = self . lower_generic_args_of_path (
830- span,
831- item_def_id,
832- parent_args,
833- item_segment,
834- None ,
835- GenericArgPosition :: Type ,
836- ) ;
826+ let ( args, _) =
827+ self . lower_generic_args_of_path ( span, item_def_id, parent_args, item_segment, None ) ;
837828 if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
838829 prohibit_assoc_item_constraint ( self , c, Some ( ( item_def_id, item_segment, span) ) ) ;
839830 }
@@ -945,7 +936,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
945936 & [ ] ,
946937 segment,
947938 Some ( self_ty) ,
948- GenericArgPosition :: Type ,
949939 ) ;
950940
951941 let constraints = segment. args ( ) . constraints ;
@@ -1121,14 +1111,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
11211111 ) -> ty:: TraitRef < ' tcx > {
11221112 self . report_internal_fn_trait ( span, trait_def_id, trait_segment, is_impl) ;
11231113
1124- let ( generic_args, _) = self . lower_generic_args_of_path (
1125- span,
1126- trait_def_id,
1127- & [ ] ,
1128- trait_segment,
1129- Some ( self_ty) ,
1130- GenericArgPosition :: Type ,
1131- ) ;
1114+ let ( generic_args, _) =
1115+ self . lower_generic_args_of_path ( span, trait_def_id, & [ ] , trait_segment, Some ( self_ty) ) ;
11321116 if let Some ( c) = trait_segment. args ( ) . constraints . first ( ) {
11331117 prohibit_assoc_item_constraint ( self , c, Some ( ( trait_def_id, trait_segment, span) ) ) ;
11341118 }
0 commit comments