@@ -117,7 +117,6 @@ pub fn provide(providers: &mut Providers) {
117117/// `probe_ty_param_bounds` requests, drawing the information from
118118/// the HIR (`hir::Generics`), recursively.
119119pub struct ItemCtxt < ' tcx > {
120- tcx : TyCtxt < ' tcx > ,
121120 item_def_id : LocalDefId ,
122121 infcx : InferCtxt < ' tcx > ,
123122}
@@ -341,19 +340,19 @@ fn bad_placeholder<'tcx>(
341340
342341impl < ' tcx > ItemCtxt < ' tcx > {
343342 pub fn new ( tcx : TyCtxt < ' tcx > , item_def_id : LocalDefId ) -> ItemCtxt < ' tcx > {
344- ItemCtxt { tcx , item_def_id, infcx : tcx. infer_ctxt ( ) . ignoring_regions ( ) . build ( ) }
343+ ItemCtxt { item_def_id, infcx : tcx. infer_ctxt ( ) . ignoring_regions ( ) . build ( ) }
345344 }
346345
347346 pub fn lower_ty ( & self , hir_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
348347 self . lowerer ( ) . lower_ty ( hir_ty)
349348 }
350349
351350 pub fn hir_id ( & self ) -> hir:: HirId {
352- self . tcx . local_def_id_to_hir_id ( self . item_def_id )
351+ self . tcx ( ) . local_def_id_to_hir_id ( self . item_def_id )
353352 }
354353
355354 pub fn node ( & self ) -> hir:: Node < ' tcx > {
356- self . tcx . hir_node ( self . hir_id ( ) )
355+ self . tcx ( ) . hir_node ( self . hir_id ( ) )
357356 }
358357
359358 fn check_tainted_by_errors ( & self ) -> Result < ( ) , ErrorGuaranteed > {
@@ -366,7 +365,7 @@ impl<'tcx> ItemCtxt<'tcx> {
366365
367366impl < ' tcx > HirTyLowerer < ' tcx > for ItemCtxt < ' tcx > {
368367 fn tcx ( & self ) -> TyCtxt < ' tcx > {
369- self . tcx
368+ self . infcx . tcx
370369 }
371370
372371 fn item_def_id ( & self ) -> LocalDefId {
@@ -386,7 +385,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
386385 }
387386
388387 fn ct_infer ( & self , ty : Ty < ' tcx > , _: Option < & ty:: GenericParamDef > , span : Span ) -> Const < ' tcx > {
389- let ty = self . tcx . fold_regions ( ty, |r, _| match * r {
388+ let ty = self . tcx ( ) . fold_regions ( ty, |r, _| match * r {
390389 rustc_type_ir:: RegionKind :: ReStatic => r,
391390
392391 // This is never reached in practice. If it ever is reached,
@@ -403,7 +402,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
403402 def_id : LocalDefId ,
404403 assoc_name : Ident ,
405404 ) -> ty:: GenericPredicates < ' tcx > {
406- self . tcx . at ( span) . type_param_predicates ( ( self . item_def_id , def_id, assoc_name) )
405+ self . tcx ( ) . at ( span) . type_param_predicates ( ( self . item_def_id , def_id, assoc_name) )
407406 }
408407
409408 fn lower_assoc_ty (
@@ -429,14 +428,15 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
429428 match self . node ( ) {
430429 hir:: Node :: Field ( _) | hir:: Node :: Ctor ( _) | hir:: Node :: Variant ( _) => {
431430 let item = self
432- . tcx
431+ . tcx ( )
433432 . hir ( )
434- . expect_item ( self . tcx . hir ( ) . get_parent_item ( self . hir_id ( ) ) . def_id ) ;
433+ . expect_item ( self . tcx ( ) . hir ( ) . get_parent_item ( self . hir_id ( ) ) . def_id ) ;
435434 match & item. kind {
436435 hir:: ItemKind :: Enum ( _, generics)
437436 | hir:: ItemKind :: Struct ( _, generics)
438437 | hir:: ItemKind :: Union ( _, generics) => {
439- let lt_name = get_new_lifetime_name ( self . tcx , poly_trait_ref, generics) ;
438+ let lt_name =
439+ get_new_lifetime_name ( self . tcx ( ) , poly_trait_ref, generics) ;
440440 let ( lt_sp, sugg) = match generics. params {
441441 [ ] => ( generics. span , format ! ( "<{lt_name}>" ) ) ,
442442 [ bound, ..] => ( bound. span . shrink_to_lo ( ) , format ! ( "{lt_name}, " ) ) ,
@@ -448,10 +448,10 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
448448 second : format ! (
449449 "{}::" ,
450450 // Replace the existing lifetimes with a new named lifetime.
451- self . tcx. instantiate_bound_regions_uncached(
451+ self . tcx( ) . instantiate_bound_regions_uncached(
452452 poly_trait_ref,
453453 |_| {
454- ty:: Region :: new_early_param( self . tcx, ty:: EarlyParamRegion {
454+ ty:: Region :: new_early_param( self . tcx( ) , ty:: EarlyParamRegion {
455455 index: 0 ,
456456 name: Symbol :: intern( & lt_name) ,
457457 } )
@@ -476,7 +476,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
476476 bound = format ! (
477477 "{}::" ,
478478 // Erase named lt, we want `<A as B<'_>::C`, not `<A as B<'a>::C`.
479- self . tcx. anonymize_bound_vars( poly_trait_ref) . skip_binder( ) ,
479+ self . tcx( ) . anonymize_bound_vars( poly_trait_ref) . skip_binder( ) ,
480480 ) ;
481481 }
482482 _ => { }
0 commit comments