@@ -58,25 +58,25 @@ where
5858/// gets mapped to the same result. `BoundVarReplacer` caches by using
5959/// a `DelayedMap` which does not cache the first few types it encounters.
6060pub trait BoundVarReplacerDelegate < ' tcx > {
61- fn replace_region ( & mut self , br : ty:: BoundRegion ) -> ty:: Region < ' tcx > ;
62- fn replace_ty ( & mut self , bt : ty:: BoundTy ) -> Ty < ' tcx > ;
61+ fn replace_region ( & mut self , br : ty:: BoundRegion < ' tcx > ) -> ty:: Region < ' tcx > ;
62+ fn replace_ty ( & mut self , bt : ty:: BoundTy < ' tcx > ) -> Ty < ' tcx > ;
6363 fn replace_const ( & mut self , bc : ty:: BoundConst ) -> ty:: Const < ' tcx > ;
6464}
6565
6666/// A simple delegate taking 3 mutable functions. The used functions must
6767/// always return the same result for each bound variable, no matter how
6868/// frequently they are called.
6969pub struct FnMutDelegate < ' a , ' tcx > {
70- pub regions : & ' a mut ( dyn FnMut ( ty:: BoundRegion ) -> ty:: Region < ' tcx > + ' a ) ,
71- pub types : & ' a mut ( dyn FnMut ( ty:: BoundTy ) -> Ty < ' tcx > + ' a ) ,
70+ pub regions : & ' a mut ( dyn FnMut ( ty:: BoundRegion < ' tcx > ) -> ty:: Region < ' tcx > + ' a ) ,
71+ pub types : & ' a mut ( dyn FnMut ( ty:: BoundTy < ' tcx > ) -> Ty < ' tcx > + ' a ) ,
7272 pub consts : & ' a mut ( dyn FnMut ( ty:: BoundConst ) -> ty:: Const < ' tcx > + ' a ) ,
7373}
7474
7575impl < ' a , ' tcx > BoundVarReplacerDelegate < ' tcx > for FnMutDelegate < ' a , ' tcx > {
76- fn replace_region ( & mut self , br : ty:: BoundRegion ) -> ty:: Region < ' tcx > {
76+ fn replace_region ( & mut self , br : ty:: BoundRegion < ' tcx > ) -> ty:: Region < ' tcx > {
7777 ( self . regions ) ( br)
7878 }
79- fn replace_ty ( & mut self , bt : ty:: BoundTy ) -> Ty < ' tcx > {
79+ fn replace_ty ( & mut self , bt : ty:: BoundTy < ' tcx > ) -> Ty < ' tcx > {
8080 ( self . types ) ( bt)
8181 }
8282 fn replace_const ( & mut self , bc : ty:: BoundConst ) -> ty:: Const < ' tcx > {
@@ -207,13 +207,14 @@ impl<'tcx> TyCtxt<'tcx> {
207207 self ,
208208 value : Binder < ' tcx , T > ,
209209 mut fld_r : F ,
210- ) -> ( T , FxIndexMap < ty:: BoundRegion , ty:: Region < ' tcx > > )
210+ ) -> ( T , FxIndexMap < ty:: BoundRegion < ' tcx > , ty:: Region < ' tcx > > )
211211 where
212- F : FnMut ( ty:: BoundRegion ) -> ty:: Region < ' tcx > ,
212+ F : FnMut ( ty:: BoundRegion < ' tcx > ) -> ty:: Region < ' tcx > ,
213213 T : TypeFoldable < TyCtxt < ' tcx > > ,
214214 {
215215 let mut region_map = FxIndexMap :: default ( ) ;
216- let real_fld_r = |br : ty:: BoundRegion | * region_map. entry ( br) . or_insert_with ( || fld_r ( br) ) ;
216+ let real_fld_r =
217+ |br : ty:: BoundRegion < ' tcx > | * region_map. entry ( br) . or_insert_with ( || fld_r ( br) ) ;
217218 let value = self . instantiate_bound_regions_uncached ( value, real_fld_r) ;
218219 ( value, region_map)
219220 }
@@ -224,7 +225,7 @@ impl<'tcx> TyCtxt<'tcx> {
224225 mut replace_regions : F ,
225226 ) -> T
226227 where
227- F : FnMut ( ty:: BoundRegion ) -> ty:: Region < ' tcx > ,
228+ F : FnMut ( ty:: BoundRegion < ' tcx > ) -> ty:: Region < ' tcx > ,
228229 T : TypeFoldable < TyCtxt < ' tcx > > ,
229230 {
230231 let value = value. skip_binder ( ) ;
@@ -292,14 +293,14 @@ impl<'tcx> TyCtxt<'tcx> {
292293 self . replace_escaping_bound_vars_uncached (
293294 value,
294295 FnMutDelegate {
295- regions : & mut |r : ty:: BoundRegion | {
296+ regions : & mut |r : ty:: BoundRegion < ' tcx > | {
296297 ty:: Region :: new_bound (
297298 self ,
298299 ty:: INNERMOST ,
299300 ty:: BoundRegion { var : shift_bv ( r. var ) , kind : r. kind } ,
300301 )
301302 } ,
302- types : & mut |t : ty:: BoundTy | {
303+ types : & mut |t : ty:: BoundTy < ' tcx > | {
303304 Ty :: new_bound (
304305 self ,
305306 ty:: INNERMOST ,
@@ -333,10 +334,10 @@ impl<'tcx> TyCtxt<'tcx> {
333334 {
334335 struct Anonymize < ' a , ' tcx > {
335336 tcx : TyCtxt < ' tcx > ,
336- map : & ' a mut FxIndexMap < ty:: BoundVar , ty:: BoundVariableKind > ,
337+ map : & ' a mut FxIndexMap < ty:: BoundVar , ty:: BoundVariableKind < ' tcx > > ,
337338 }
338339 impl < ' tcx > BoundVarReplacerDelegate < ' tcx > for Anonymize < ' _ , ' tcx > {
339- fn replace_region ( & mut self , br : ty:: BoundRegion ) -> ty:: Region < ' tcx > {
340+ fn replace_region ( & mut self , br : ty:: BoundRegion < ' tcx > ) -> ty:: Region < ' tcx > {
340341 let entry = self . map . entry ( br. var ) ;
341342 let index = entry. index ( ) ;
342343 let var = ty:: BoundVar :: from_usize ( index) ;
@@ -346,7 +347,7 @@ impl<'tcx> TyCtxt<'tcx> {
346347 let br = ty:: BoundRegion { var, kind } ;
347348 ty:: Region :: new_bound ( self . tcx , ty:: INNERMOST , br)
348349 }
349- fn replace_ty ( & mut self , bt : ty:: BoundTy ) -> Ty < ' tcx > {
350+ fn replace_ty ( & mut self , bt : ty:: BoundTy < ' tcx > ) -> Ty < ' tcx > {
350351 let entry = self . map . entry ( bt. var ) ;
351352 let index = entry. index ( ) ;
352353 let var = ty:: BoundVar :: from_usize ( index) ;
0 commit comments