@@ -117,7 +117,6 @@ pub fn provide(providers: &mut Providers) {
117
117
/// `probe_ty_param_bounds` requests, drawing the information from
118
118
/// the HIR (`hir::Generics`), recursively.
119
119
pub struct ItemCtxt < ' tcx > {
120
- tcx : TyCtxt < ' tcx > ,
121
120
item_def_id : LocalDefId ,
122
121
infcx : InferCtxt < ' tcx > ,
123
122
}
@@ -341,19 +340,19 @@ fn bad_placeholder<'tcx>(
341
340
342
341
impl < ' tcx > ItemCtxt < ' tcx > {
343
342
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 ( ) }
345
344
}
346
345
347
346
pub fn lower_ty ( & self , hir_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
348
347
self . lowerer ( ) . lower_ty ( hir_ty)
349
348
}
350
349
351
350
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 )
353
352
}
354
353
355
354
pub fn node ( & self ) -> hir:: Node < ' tcx > {
356
- self . tcx . hir_node ( self . hir_id ( ) )
355
+ self . tcx ( ) . hir_node ( self . hir_id ( ) )
357
356
}
358
357
359
358
fn check_tainted_by_errors ( & self ) -> Result < ( ) , ErrorGuaranteed > {
@@ -366,7 +365,7 @@ impl<'tcx> ItemCtxt<'tcx> {
366
365
367
366
impl < ' tcx > HirTyLowerer < ' tcx > for ItemCtxt < ' tcx > {
368
367
fn tcx ( & self ) -> TyCtxt < ' tcx > {
369
- self . tcx
368
+ self . infcx . tcx
370
369
}
371
370
372
371
fn item_def_id ( & self ) -> LocalDefId {
@@ -386,7 +385,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
386
385
}
387
386
388
387
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 {
390
389
rustc_type_ir:: RegionKind :: ReStatic => r,
391
390
392
391
// This is never reached in practice. If it ever is reached,
@@ -403,7 +402,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
403
402
def_id : LocalDefId ,
404
403
assoc_name : Ident ,
405
404
) -> 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) )
407
406
}
408
407
409
408
fn lower_assoc_ty (
@@ -429,14 +428,15 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
429
428
match self . node ( ) {
430
429
hir:: Node :: Field ( _) | hir:: Node :: Ctor ( _) | hir:: Node :: Variant ( _) => {
431
430
let item = self
432
- . tcx
431
+ . tcx ( )
433
432
. 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 ) ;
435
434
match & item. kind {
436
435
hir:: ItemKind :: Enum ( _, generics)
437
436
| hir:: ItemKind :: Struct ( _, generics)
438
437
| 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) ;
440
440
let ( lt_sp, sugg) = match generics. params {
441
441
[ ] => ( generics. span , format ! ( "<{lt_name}>" ) ) ,
442
442
[ bound, ..] => ( bound. span . shrink_to_lo ( ) , format ! ( "{lt_name}, " ) ) ,
@@ -448,10 +448,10 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
448
448
second : format ! (
449
449
"{}::" ,
450
450
// Replace the existing lifetimes with a new named lifetime.
451
- self . tcx. instantiate_bound_regions_uncached(
451
+ self . tcx( ) . instantiate_bound_regions_uncached(
452
452
poly_trait_ref,
453
453
|_| {
454
- ty:: Region :: new_early_param( self . tcx, ty:: EarlyParamRegion {
454
+ ty:: Region :: new_early_param( self . tcx( ) , ty:: EarlyParamRegion {
455
455
index: 0 ,
456
456
name: Symbol :: intern( & lt_name) ,
457
457
} )
@@ -476,7 +476,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
476
476
bound = format ! (
477
477
"{}::" ,
478
478
// 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( ) ,
480
480
) ;
481
481
}
482
482
_ => { }
0 commit comments