@@ -106,7 +106,7 @@ pub trait AstConv<'tcx> {
106
106
& self ,
107
107
span : Span ,
108
108
item_def_id : DefId ,
109
- item_segment : & hir:: PathSegment < ' _ > ,
109
+ item_segment : & hir:: PathSegment < ' tcx > ,
110
110
poly_trait_ref : ty:: PolyTraitRef < ' tcx > ,
111
111
) -> Ty < ' tcx > ;
112
112
@@ -140,14 +140,14 @@ struct ConvertedBinding<'a, 'tcx> {
140
140
hir_id : hir:: HirId ,
141
141
item_name : Ident ,
142
142
kind : ConvertedBindingKind < ' a , ' tcx > ,
143
- gen_args : & ' a GenericArgs < ' a > ,
143
+ gen_args : & ' tcx GenericArgs < ' tcx > ,
144
144
span : Span ,
145
145
}
146
146
147
147
#[ derive( Debug ) ]
148
148
enum ConvertedBindingKind < ' a , ' tcx > {
149
149
Equality ( ty:: Term < ' tcx > ) ,
150
- Constraint ( & ' a [ hir:: GenericBound < ' a > ] ) ,
150
+ Constraint ( & ' a [ hir:: GenericBound < ' tcx > ] ) ,
151
151
}
152
152
153
153
/// New-typed boolean indicating whether explicit late-bound lifetimes
@@ -199,12 +199,12 @@ pub struct GenericArgCountResult {
199
199
}
200
200
201
201
pub trait CreateSubstsForGenericArgsCtxt < ' a , ' tcx > {
202
- fn args_for_def_id ( & mut self , def_id : DefId ) -> ( Option < & ' a GenericArgs < ' a > > , bool ) ;
202
+ fn args_for_def_id ( & mut self , def_id : DefId ) -> ( Option < & ' a GenericArgs < ' tcx > > , bool ) ;
203
203
204
204
fn provided_kind (
205
205
& mut self ,
206
206
param : & ty:: GenericParamDef ,
207
- arg : & GenericArg < ' _ > ,
207
+ arg : & GenericArg < ' tcx > ,
208
208
) -> subst:: GenericArg < ' tcx > ;
209
209
210
210
fn inferred_kind (
@@ -279,7 +279,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
279
279
& self ,
280
280
span : Span ,
281
281
def_id : DefId ,
282
- item_segment : & hir:: PathSegment < ' _ > ,
282
+ item_segment : & hir:: PathSegment < ' tcx > ,
283
283
) -> SubstsRef < ' tcx > {
284
284
let ( substs, _) = self . create_substs_for_ast_path (
285
285
span,
@@ -336,7 +336,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
336
336
def_id : DefId ,
337
337
parent_substs : & [ subst:: GenericArg < ' tcx > ] ,
338
338
seg : & hir:: PathSegment < ' _ > ,
339
- generic_args : & ' a hir:: GenericArgs < ' _ > ,
339
+ generic_args : & ' a hir:: GenericArgs < ' tcx > ,
340
340
infer_args : bool ,
341
341
self_ty : Option < Ty < ' tcx > > ,
342
342
constness : ty:: BoundConstness ,
@@ -385,14 +385,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
385
385
struct SubstsForAstPathCtxt < ' a , ' tcx > {
386
386
astconv : & ' a ( dyn AstConv < ' tcx > + ' a ) ,
387
387
def_id : DefId ,
388
- generic_args : & ' a GenericArgs < ' a > ,
388
+ generic_args : & ' a GenericArgs < ' tcx > ,
389
389
span : Span ,
390
390
inferred_params : Vec < Span > ,
391
391
infer_args : bool ,
392
392
}
393
393
394
394
impl < ' a , ' tcx > CreateSubstsForGenericArgsCtxt < ' a , ' tcx > for SubstsForAstPathCtxt < ' a , ' tcx > {
395
- fn args_for_def_id ( & mut self , did : DefId ) -> ( Option < & ' a GenericArgs < ' a > > , bool ) {
395
+ fn args_for_def_id ( & mut self , did : DefId ) -> ( Option < & ' a GenericArgs < ' tcx > > , bool ) {
396
396
if did == self . def_id {
397
397
( Some ( self . generic_args ) , self . infer_args )
398
398
} else {
@@ -404,11 +404,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
404
404
fn provided_kind (
405
405
& mut self ,
406
406
param : & ty:: GenericParamDef ,
407
- arg : & GenericArg < ' _ > ,
407
+ arg : & GenericArg < ' tcx > ,
408
408
) -> subst:: GenericArg < ' tcx > {
409
409
let tcx = self . astconv . tcx ( ) ;
410
410
411
- let mut handle_ty_args = |has_default, ty : & hir:: Ty < ' _ > | {
411
+ let mut handle_ty_args = |has_default, ty : & hir:: Ty < ' tcx > | {
412
412
if has_default {
413
413
tcx. check_optional_stability (
414
414
param. def_id ,
@@ -556,7 +556,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
556
556
557
557
fn create_assoc_bindings_for_generic_args < ' a > (
558
558
& self ,
559
- generic_args : & ' a hir:: GenericArgs < ' _ > ,
559
+ generic_args : & ' a hir:: GenericArgs < ' tcx > ,
560
560
) -> Vec < ConvertedBinding < ' a , ' tcx > > {
561
561
// Convert associated-type bindings or constraints into a separate vector.
562
562
// Example: Given this:
@@ -602,7 +602,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
602
602
& self ,
603
603
span : Span ,
604
604
item_def_id : DefId ,
605
- item_segment : & hir:: PathSegment < ' _ > ,
605
+ item_segment : & hir:: PathSegment < ' tcx > ,
606
606
parent_substs : SubstsRef < ' tcx > ,
607
607
) -> SubstsRef < ' tcx > {
608
608
debug ! (
@@ -635,7 +635,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
635
635
/// are disallowed. Otherwise, they are pushed onto the vector given.
636
636
pub fn instantiate_mono_trait_ref (
637
637
& self ,
638
- trait_ref : & hir:: TraitRef < ' _ > ,
638
+ trait_ref : & hir:: TraitRef < ' tcx > ,
639
639
self_ty : Ty < ' tcx > ,
640
640
constness : ty:: BoundConstness ,
641
641
) -> ty:: TraitRef < ' tcx > {
@@ -662,7 +662,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
662
662
trait_ref_span : Span ,
663
663
trait_def_id : DefId ,
664
664
trait_segment : & hir:: PathSegment < ' _ > ,
665
- args : & GenericArgs < ' _ > ,
665
+ args : & GenericArgs < ' tcx > ,
666
666
infer_args : bool ,
667
667
self_ty : Ty < ' tcx > ,
668
668
) -> GenericArgCountResult {
@@ -730,7 +730,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
730
730
#[ instrument( level = "debug" , skip( self , span, constness, bounds, speculative) ) ]
731
731
pub ( crate ) fn instantiate_poly_trait_ref (
732
732
& self ,
733
- trait_ref : & hir:: TraitRef < ' _ > ,
733
+ trait_ref : & hir:: TraitRef < ' tcx > ,
734
734
span : Span ,
735
735
constness : ty:: BoundConstness ,
736
736
self_ty : Ty < ' tcx > ,
@@ -769,7 +769,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
769
769
lang_item : hir:: LangItem ,
770
770
span : Span ,
771
771
hir_id : hir:: HirId ,
772
- args : & GenericArgs < ' _ > ,
772
+ args : & GenericArgs < ' tcx > ,
773
773
self_ty : Ty < ' tcx > ,
774
774
bounds : & mut Bounds < ' tcx > ,
775
775
) {
@@ -802,7 +802,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
802
802
span : Span ,
803
803
trait_def_id : DefId ,
804
804
self_ty : Ty < ' tcx > ,
805
- trait_segment : & hir:: PathSegment < ' _ > ,
805
+ trait_segment : & hir:: PathSegment < ' tcx > ,
806
806
is_impl : bool ,
807
807
constness : ty:: BoundConstness ,
808
808
) -> ty:: TraitRef < ' tcx > {
@@ -826,7 +826,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
826
826
span : Span ,
827
827
trait_def_id : DefId ,
828
828
self_ty : Ty < ' tcx > ,
829
- trait_segment : & ' a hir:: PathSegment < ' a > ,
829
+ trait_segment : & ' a hir:: PathSegment < ' tcx > ,
830
830
is_impl : bool ,
831
831
constness : ty:: BoundConstness ,
832
832
) -> ( SubstsRef < ' tcx > , GenericArgCountResult ) {
@@ -937,13 +937,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
937
937
/// `param_ty` and `ast_bounds`. See `instantiate_poly_trait_ref`
938
938
/// for more details.
939
939
#[ instrument( level = "debug" , skip( self , ast_bounds, bounds) ) ]
940
- pub ( crate ) fn add_bounds < ' hir , I : Iterator < Item = & ' hir hir:: GenericBound < ' hir > > > (
940
+ pub ( crate ) fn add_bounds < ' hir , I : Iterator < Item = & ' hir hir:: GenericBound < ' tcx > > > (
941
941
& self ,
942
942
param_ty : Ty < ' tcx > ,
943
943
ast_bounds : I ,
944
944
bounds : & mut Bounds < ' tcx > ,
945
945
bound_vars : & ' tcx ty:: List < ty:: BoundVariableKind > ,
946
- ) {
946
+ ) where
947
+ ' tcx : ' hir ,
948
+ {
947
949
for ast_bound in ast_bounds {
948
950
match ast_bound {
949
951
hir:: GenericBound :: Trait ( poly_trait_ref, modifier) => {
@@ -1001,7 +1003,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1001
1003
pub ( crate ) fn compute_bounds (
1002
1004
& self ,
1003
1005
param_ty : Ty < ' tcx > ,
1004
- ast_bounds : & [ hir:: GenericBound < ' _ > ] ,
1006
+ ast_bounds : & [ hir:: GenericBound < ' tcx > ] ,
1005
1007
) -> Bounds < ' tcx > {
1006
1008
self . compute_bounds_inner ( param_ty, ast_bounds)
1007
1009
}
@@ -1011,7 +1013,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1011
1013
pub ( crate ) fn compute_bounds_that_match_assoc_type (
1012
1014
& self ,
1013
1015
param_ty : Ty < ' tcx > ,
1014
- ast_bounds : & [ hir:: GenericBound < ' _ > ] ,
1016
+ ast_bounds : & [ hir:: GenericBound < ' tcx > ] ,
1015
1017
assoc_name : Ident ,
1016
1018
) -> Bounds < ' tcx > {
1017
1019
let mut result = Vec :: new ( ) ;
@@ -1031,7 +1033,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1031
1033
fn compute_bounds_inner (
1032
1034
& self ,
1033
1035
param_ty : Ty < ' tcx > ,
1034
- ast_bounds : & [ hir:: GenericBound < ' _ > ] ,
1036
+ ast_bounds : & [ hir:: GenericBound < ' tcx > ] ,
1035
1037
) -> Bounds < ' tcx > {
1036
1038
let mut bounds = Bounds :: default ( ) ;
1037
1039
@@ -1269,7 +1271,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1269
1271
& self ,
1270
1272
span : Span ,
1271
1273
did : DefId ,
1272
- item_segment : & hir:: PathSegment < ' _ > ,
1274
+ item_segment : & hir:: PathSegment < ' tcx > ,
1273
1275
) -> Ty < ' tcx > {
1274
1276
let substs = self . ast_path_substs_for_ty ( span, did, item_segment) ;
1275
1277
self . tcx ( ) . at ( span) . bound_type_of ( did) . subst ( self . tcx ( ) , substs)
@@ -1278,7 +1280,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1278
1280
fn conv_object_ty_poly_trait_ref (
1279
1281
& self ,
1280
1282
span : Span ,
1281
- hir_trait_bounds : & [ hir:: PolyTraitRef < ' _ > ] ,
1283
+ hir_trait_bounds : & [ hir:: PolyTraitRef < ' tcx > ] ,
1282
1284
lifetime : & hir:: Lifetime ,
1283
1285
borrowed : bool ,
1284
1286
representation : DynKind ,
@@ -1925,7 +1927,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1925
1927
span : Span ,
1926
1928
qself_ty : Ty < ' tcx > ,
1927
1929
qself : & hir:: Ty < ' _ > ,
1928
- assoc_segment : & hir:: PathSegment < ' _ > ,
1930
+ assoc_segment : & hir:: PathSegment < ' tcx > ,
1929
1931
permit_variants : bool ,
1930
1932
) -> Result < ( Ty < ' tcx > , DefKind , DefId ) , ErrorGuaranteed > {
1931
1933
let tcx = self . tcx ( ) ;
@@ -2286,8 +2288,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2286
2288
span : Span ,
2287
2289
opt_self_ty : Option < Ty < ' tcx > > ,
2288
2290
item_def_id : DefId ,
2289
- trait_segment : & hir:: PathSegment < ' _ > ,
2290
- item_segment : & hir:: PathSegment < ' _ > ,
2291
+ trait_segment : & hir:: PathSegment < ' tcx > ,
2292
+ item_segment : & hir:: PathSegment < ' tcx > ,
2291
2293
constness : ty:: BoundConstness ,
2292
2294
) -> Ty < ' tcx > {
2293
2295
let tcx = self . tcx ( ) ;
@@ -2604,7 +2606,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2604
2606
pub fn res_to_ty (
2605
2607
& self ,
2606
2608
opt_self_ty : Option < Ty < ' tcx > > ,
2607
- path : & hir:: Path < ' _ > ,
2609
+ path : & hir:: Path < ' tcx > ,
2608
2610
permit_variants : bool ,
2609
2611
) -> Ty < ' tcx > {
2610
2612
let tcx = self . tcx ( ) ;
@@ -2843,20 +2845,25 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2843
2845
2844
2846
/// Parses the programmer's textual representation of a type into our
2845
2847
/// internal notion of a type.
2846
- pub fn ast_ty_to_ty ( & self , ast_ty : & hir:: Ty < ' _ > ) -> Ty < ' tcx > {
2848
+ pub fn ast_ty_to_ty ( & self , ast_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
2847
2849
self . ast_ty_to_ty_inner ( ast_ty, false , false )
2848
2850
}
2849
2851
2850
2852
/// Parses the programmer's textual representation of a type into our
2851
2853
/// internal notion of a type. This is meant to be used within a path.
2852
- pub fn ast_ty_to_ty_in_path ( & self , ast_ty : & hir:: Ty < ' _ > ) -> Ty < ' tcx > {
2854
+ pub fn ast_ty_to_ty_in_path ( & self , ast_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
2853
2855
self . ast_ty_to_ty_inner ( ast_ty, false , true )
2854
2856
}
2855
2857
2856
2858
/// Turns a `hir::Ty` into a `Ty`. For diagnostics' purposes we keep track of whether trait
2857
2859
/// objects are borrowed like `&dyn Trait` to avoid emitting redundant errors.
2858
2860
#[ instrument( level = "debug" , skip( self ) , ret) ]
2859
- fn ast_ty_to_ty_inner ( & self , ast_ty : & hir:: Ty < ' _ > , borrowed : bool , in_path : bool ) -> Ty < ' tcx > {
2861
+ fn ast_ty_to_ty_inner (
2862
+ & self ,
2863
+ ast_ty : & hir:: Ty < ' tcx > ,
2864
+ borrowed : bool ,
2865
+ in_path : bool ,
2866
+ ) -> Ty < ' tcx > {
2860
2867
let tcx = self . tcx ( ) ;
2861
2868
2862
2869
let result_ty = match & ast_ty. kind {
@@ -3014,7 +3021,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
3014
3021
if in_trait { tcx. mk_projection ( def_id, substs) } else { tcx. mk_opaque ( def_id, substs) }
3015
3022
}
3016
3023
3017
- pub fn ty_of_arg ( & self , ty : & hir:: Ty < ' _ > , expected_ty : Option < Ty < ' tcx > > ) -> Ty < ' tcx > {
3024
+ pub fn ty_of_arg ( & self , ty : & hir:: Ty < ' tcx > , expected_ty : Option < Ty < ' tcx > > ) -> Ty < ' tcx > {
3018
3025
match ty. kind {
3019
3026
hir:: TyKind :: Infer if expected_ty. is_some ( ) => {
3020
3027
self . record_ty ( ty. hir_id , expected_ty. unwrap ( ) , ty. span ) ;
@@ -3030,7 +3037,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
3030
3037
hir_id : hir:: HirId ,
3031
3038
unsafety : hir:: Unsafety ,
3032
3039
abi : abi:: Abi ,
3033
- decl : & hir:: FnDecl < ' _ > ,
3040
+ decl : & hir:: FnDecl < ' tcx > ,
3034
3041
generics : Option < & hir:: Generics < ' _ > > ,
3035
3042
hir_ty : Option < & hir:: Ty < ' _ > > ,
3036
3043
) -> ty:: PolyFnSig < ' tcx > {
0 commit comments