@@ -288,8 +288,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
288
288
def_id,
289
289
& [ ] ,
290
290
item_segment,
291
- item_segment. args ( ) ,
292
- item_segment. infer_args ,
293
291
None ,
294
292
ty:: BoundConstness :: NotConst ,
295
293
) ;
@@ -332,14 +330,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
332
330
/// type itself: `['a]`. The returned `SubstsRef` concatenates these two
333
331
/// lists: `[Vec<u8>, u8, 'a]`.
334
332
#[ instrument( level = "debug" , skip( self , span) , ret) ]
335
- fn create_substs_for_ast_path < ' a > (
333
+ fn create_substs_for_ast_path (
336
334
& self ,
337
335
span : Span ,
338
336
def_id : DefId ,
339
337
parent_substs : & [ subst:: GenericArg < ' tcx > ] ,
340
338
seg : & hir:: PathSegment < ' _ > ,
341
- generic_args : & ' a hir:: GenericArgs < ' _ > ,
342
- infer_args : bool ,
343
339
self_ty : Option < Ty < ' tcx > > ,
344
340
constness : ty:: BoundConstness ,
345
341
) -> ( SubstsRef < ' tcx > , GenericArgCountResult ) {
@@ -370,10 +366,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
370
366
def_id,
371
367
seg,
372
368
generics,
373
- generic_args,
374
369
GenericArgPosition :: Type ,
375
370
self_ty. is_some ( ) ,
376
- infer_args,
377
371
) ;
378
372
379
373
// Skip processing if type has no generic parameters.
@@ -540,9 +534,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
540
534
astconv : self ,
541
535
def_id,
542
536
span,
543
- generic_args,
537
+ generic_args : seg . args ( ) ,
544
538
inferred_params : vec ! [ ] ,
545
- infer_args,
539
+ infer_args : seg . infer_args ,
546
540
} ;
547
541
let substs = create_substs_for_generic_args (
548
542
tcx,
@@ -623,8 +617,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
623
617
item_def_id,
624
618
parent_substs,
625
619
item_segment,
626
- item_segment. args ( ) ,
627
- item_segment. infer_args ,
628
620
None ,
629
621
ty:: BoundConstness :: NotConst ,
630
622
) ;
@@ -671,17 +663,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
671
663
trait_ref_span : Span ,
672
664
trait_def_id : DefId ,
673
665
trait_segment : & hir:: PathSegment < ' _ > ,
674
- args : & GenericArgs < ' _ > ,
675
- infer_args : bool ,
676
666
self_ty : Ty < ' tcx > ,
677
667
) -> GenericArgCountResult {
678
668
let ( substs, arg_count) = self . create_substs_for_ast_path (
679
669
trait_ref_span,
680
670
trait_def_id,
681
671
& [ ] ,
682
672
trait_segment,
683
- args,
684
- infer_args,
685
673
Some ( self_ty) ,
686
674
constness,
687
675
) ;
@@ -690,7 +678,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
690
678
let bound_vars = tcx. late_bound_vars ( hir_id) ;
691
679
debug ! ( ?bound_vars) ;
692
680
693
- let assoc_bindings = self . create_assoc_bindings_for_generic_args ( args) ;
681
+ let assoc_bindings = self . create_assoc_bindings_for_generic_args ( trait_segment . args ( ) ) ;
694
682
695
683
let poly_trait_ref =
696
684
ty:: Binder :: bind_with_vars ( tcx. mk_trait_ref ( trait_def_id, substs) , bound_vars) ;
@@ -751,8 +739,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
751
739
let trait_ref_span = trait_ref. path . span ;
752
740
let trait_def_id = trait_ref. trait_def_id ( ) . unwrap_or_else ( || FatalError . raise ( ) ) ;
753
741
let trait_segment = trait_ref. path . segments . last ( ) . unwrap ( ) ;
754
- let args = trait_segment. args ( ) ;
755
- let infer_args = trait_segment. infer_args ;
756
742
757
743
self . prohibit_generics ( trait_ref. path . segments . split_last ( ) . unwrap ( ) . 1 . iter ( ) , |_| { } ) ;
758
744
self . complain_about_internal_fn_trait ( span, trait_def_id, trait_segment, false ) ;
@@ -767,8 +753,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
767
753
trait_ref_span,
768
754
trait_def_id,
769
755
trait_segment,
770
- args,
771
- infer_args,
772
756
self_ty,
773
757
)
774
758
}
@@ -787,8 +771,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
787
771
let speculative = false ;
788
772
let trait_ref_span = span;
789
773
let trait_def_id = self . tcx ( ) . require_lang_item ( lang_item, Some ( span) ) ;
790
- let trait_segment = & hir:: PathSegment :: invalid ( ) ;
791
- let infer_args = false ;
774
+ let trait_segment = & hir:: PathSegment {
775
+ ident : Ident :: empty ( ) ,
776
+ hir_id : hir:: HirId :: INVALID ,
777
+ res : Res :: Err ,
778
+ args : Some ( args) ,
779
+ infer_args : false ,
780
+ } ;
792
781
793
782
self . instantiate_poly_trait_ref_inner (
794
783
hir_id,
@@ -800,8 +789,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
800
789
trait_ref_span,
801
790
trait_def_id,
802
791
trait_segment,
803
- args,
804
- infer_args,
805
792
self_ty,
806
793
) ;
807
794
}
@@ -846,8 +833,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
846
833
trait_def_id,
847
834
& [ ] ,
848
835
trait_segment,
849
- trait_segment. args ( ) ,
850
- trait_segment. infer_args ,
851
836
Some ( self_ty) ,
852
837
constness,
853
838
)
@@ -3074,8 +3059,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
3074
3059
def_id,
3075
3060
& [ ] ,
3076
3061
& hir:: PathSegment :: invalid ( ) ,
3077
- & GenericArgs :: none ( ) ,
3078
- true ,
3079
3062
None ,
3080
3063
ty:: BoundConstness :: NotConst ,
3081
3064
) ;
0 commit comments