@@ -46,12 +46,14 @@ use rustc_ast::*;
4646use rustc_errors:: ErrorGuaranteed ;
4747use rustc_hir:: def_id:: DefId ;
4848use rustc_middle:: span_bug;
49- use rustc_middle:: ty:: { Asyncness , ResolverAstLowering } ;
49+ use rustc_middle:: ty:: Asyncness ;
5050use rustc_span:: { Ident , Span , Symbol } ;
5151use { rustc_ast as ast, rustc_hir as hir} ;
5252
53- use super :: { GenericArgsMode , ImplTraitContext , LoweringContext , ParamMode } ;
54- use crate :: { AllowReturnTypeNotation , ImplTraitPosition , ResolverAstLoweringExt } ;
53+ use super :: {
54+ AllowReturnTypeNotation , GenericArgsMode , ImplTraitContext , ImplTraitPosition , LoweringContext ,
55+ ParamMode ,
56+ } ;
5557
5658pub ( crate ) struct DelegationResults < ' hir > {
5759 pub body_id : hir:: BodyId ,
@@ -60,7 +62,7 @@ pub(crate) struct DelegationResults<'hir> {
6062 pub generics : & ' hir hir:: Generics < ' hir > ,
6163}
6264
63- impl < ' hir > LoweringContext < ' _ , ' hir > {
65+ impl < ' hir > LoweringContext < ' hir > {
6466 /// Defines whether the delegatee is an associated function whose first parameter is `self`.
6567 pub ( crate ) fn delegatee_is_method (
6668 & self ,
@@ -125,8 +127,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
125127 }
126128
127129 fn get_resolution_id ( & self , node_id : NodeId , span : Span ) -> Result < DefId , ErrorGuaranteed > {
128- let def_id =
129- self . resolver . get_partial_res ( node_id) . and_then ( |r| r. expect_full_res ( ) . opt_def_id ( ) ) ;
130+ let def_id = self . get_partial_res ( node_id) . and_then ( |r| r. expect_full_res ( ) . opt_def_id ( ) ) ;
130131 def_id. ok_or_else ( || {
131132 self . tcx . dcx ( ) . span_delayed_bug (
132133 span,
@@ -281,7 +282,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
281282 && idx == 0
282283 {
283284 let mut self_resolver = SelfResolver {
284- resolver : this. resolver ,
285+ ctxt : this,
285286 path_id : delegation. id ,
286287 self_param_id : pat_node_id,
287288 } ;
@@ -427,25 +428,25 @@ impl<'hir> LoweringContext<'_, 'hir> {
427428 }
428429}
429430
430- struct SelfResolver < ' a > {
431- resolver : & ' a mut ResolverAstLowering ,
431+ struct SelfResolver < ' r , ' hir > {
432+ ctxt : & ' r mut LoweringContext < ' hir > ,
432433 path_id : NodeId ,
433434 self_param_id : NodeId ,
434435}
435436
436- impl < ' a > SelfResolver < ' a > {
437+ impl SelfResolver < ' _ , ' _ > {
437438 fn try_replace_id ( & mut self , id : NodeId ) {
438- if let Some ( res) = self . resolver . partial_res_map . get ( & id)
439+ if let Some ( res) = self . ctxt . get_partial_res ( id)
439440 && let Some ( Res :: Local ( sig_id) ) = res. full_res ( )
440441 && sig_id == self . path_id
441442 {
442443 let new_res = PartialRes :: new ( Res :: Local ( self . self_param_id ) ) ;
443- self . resolver . partial_res_map . insert ( id, new_res) ;
444+ self . ctxt . partial_res_overrides . insert ( id, new_res) ;
444445 }
445446 }
446447}
447448
448- impl < ' ast , ' a > Visitor < ' ast > for SelfResolver < ' a > {
449+ impl < ' ast > Visitor < ' ast > for SelfResolver < ' _ , ' _ > {
449450 fn visit_id ( & mut self , id : NodeId ) {
450451 self . try_replace_id ( id) ;
451452 }
0 commit comments