@@ -46,12 +46,14 @@ use rustc_ast::*;
46
46
use rustc_errors:: ErrorGuaranteed ;
47
47
use rustc_hir:: def_id:: DefId ;
48
48
use rustc_middle:: span_bug;
49
- use rustc_middle:: ty:: { Asyncness , ResolverAstLowering } ;
49
+ use rustc_middle:: ty:: Asyncness ;
50
50
use rustc_span:: { Ident , Span , Symbol } ;
51
51
use { rustc_ast as ast, rustc_hir as hir} ;
52
52
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
+ } ;
55
57
56
58
pub ( crate ) struct DelegationResults < ' hir > {
57
59
pub body_id : hir:: BodyId ,
@@ -60,7 +62,7 @@ pub(crate) struct DelegationResults<'hir> {
60
62
pub generics : & ' hir hir:: Generics < ' hir > ,
61
63
}
62
64
63
- impl < ' hir > LoweringContext < ' _ , ' hir > {
65
+ impl < ' hir > LoweringContext < ' hir > {
64
66
/// Defines whether the delegatee is an associated function whose first parameter is `self`.
65
67
pub ( crate ) fn delegatee_is_method (
66
68
& self ,
@@ -125,8 +127,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
125
127
}
126
128
127
129
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 ( ) ) ;
130
131
def_id. ok_or_else ( || {
131
132
self . tcx . dcx ( ) . span_delayed_bug (
132
133
span,
@@ -281,7 +282,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
281
282
&& idx == 0
282
283
{
283
284
let mut self_resolver = SelfResolver {
284
- resolver : this. resolver ,
285
+ ctxt : this,
285
286
path_id : delegation. id ,
286
287
self_param_id : pat_node_id,
287
288
} ;
@@ -427,25 +428,25 @@ impl<'hir> LoweringContext<'_, 'hir> {
427
428
}
428
429
}
429
430
430
- struct SelfResolver < ' a > {
431
- resolver : & ' a mut ResolverAstLowering ,
431
+ struct SelfResolver < ' r , ' hir > {
432
+ ctxt : & ' r mut LoweringContext < ' hir > ,
432
433
path_id : NodeId ,
433
434
self_param_id : NodeId ,
434
435
}
435
436
436
- impl < ' a > SelfResolver < ' a > {
437
+ impl SelfResolver < ' _ , ' _ > {
437
438
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)
439
440
&& let Some ( Res :: Local ( sig_id) ) = res. full_res ( )
440
441
&& sig_id == self . path_id
441
442
{
442
443
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) ;
444
445
}
445
446
}
446
447
}
447
448
448
- impl < ' ast , ' a > Visitor < ' ast > for SelfResolver < ' a > {
449
+ impl < ' ast > Visitor < ' ast > for SelfResolver < ' _ , ' _ > {
449
450
fn visit_id ( & mut self , id : NodeId ) {
450
451
self . try_replace_id ( id) ;
451
452
}
0 commit comments