@@ -46,13 +46,15 @@ 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::symbol::kw;
5151use rustc_span::{Ident, Span, Symbol};
5252use {rustc_ast as ast, rustc_hir as hir};
5353
54- use super::{GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode};
55- use crate::{AllowReturnTypeNotation, ImplTraitPosition, ResolverAstLoweringExt};
54+ use super::{
55+ AllowReturnTypeNotation, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,
56+ ParamMode,
57+ };
5658
5759pub(crate) struct DelegationResults<'hir> {
5860 pub body_id: hir::BodyId,
@@ -61,7 +63,7 @@ pub(crate) struct DelegationResults<'hir> {
6163 pub generics: &'hir hir::Generics<'hir>,
6264}
6365
64- impl<'hir> LoweringContext<'_, ' hir> {
66+ impl<'hir> LoweringContext<'hir> {
6567 fn is_method(&self, def_id: DefId, span: Span) -> bool {
6668 match self.tcx.def_kind(def_id) {
6769 DefKind::Fn => false,
@@ -112,8 +114,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
112114 }
113115
114116 fn get_resolution_id(&self, node_id: NodeId, span: Span) -> Result<DefId, ErrorGuaranteed> {
115- let def_id =
116- self.resolver.get_partial_res(node_id).and_then(|r| r.expect_full_res().opt_def_id());
117+ let def_id = self.get_partial_res(node_id).and_then(|r| r.expect_full_res().opt_def_id());
117118 def_id.ok_or_else(|| {
118119 self.tcx.dcx().span_delayed_bug(
119120 span,
@@ -292,7 +293,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
292293 && idx == 0
293294 {
294295 let mut self_resolver = SelfResolver {
295- resolver : this.resolver ,
296+ ctxt : this,
296297 path_id: delegation.id,
297298 self_param_id: pat_node_id,
298299 };
@@ -438,25 +439,25 @@ impl<'hir> LoweringContext<'_, 'hir> {
438439 }
439440}
440441
441- struct SelfResolver<'a > {
442- resolver : &'a mut ResolverAstLowering ,
442+ struct SelfResolver<'r, 'hir > {
443+ ctxt : &'r mut LoweringContext<'hir> ,
443444 path_id: NodeId,
444445 self_param_id: NodeId,
445446}
446447
447- impl<'a> SelfResolver<'a > {
448+ impl SelfResolver<'_, '_ > {
448449 fn try_replace_id(&mut self, id: NodeId) {
449- if let Some(res) = self.resolver.partial_res_map.get(& id)
450+ if let Some(res) = self.ctxt.get_partial_res( id)
450451 && let Some(Res::Local(sig_id)) = res.full_res()
451452 && sig_id == self.path_id
452453 {
453454 let new_res = PartialRes::new(Res::Local(self.self_param_id));
454- self.resolver.partial_res_map .insert(id, new_res);
455+ self.ctxt.partial_res_overrides .insert(id, new_res);
455456 }
456457 }
457458}
458459
459- impl<'ast, 'a > Visitor<'ast> for SelfResolver<'a > {
460+ impl<'ast> Visitor<'ast> for SelfResolver<'_, '_ > {
460461 fn visit_id(&mut self, id: NodeId) {
461462 self.try_replace_id(id);
462463 }
0 commit comments