Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
//! also be emitted during HIR ty lowering.

use std::iter;
use std::marker::PhantomData;

use ast::visit::Visitor;
use hir::def::{DefKind, PartialRes, Res};
Expand Down Expand Up @@ -420,7 +419,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
resolver: this.resolver,
path_id: delegation.id,
self_param_id: pat_node_id,
phantom: PhantomData,
};
self_resolver.visit_block(block);
// Target expr needs to lower `self` path.
Expand Down Expand Up @@ -673,14 +671,13 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
}
}

struct SelfResolver<'a, 'tcx, R> {
struct SelfResolver<'a, R> {
resolver: &'a mut R,
path_id: NodeId,
self_param_id: NodeId,
phantom: PhantomData<&'tcx ()>,
}

impl<'tcx, R: ResolverAstLoweringExt<'tcx>> SelfResolver<'_, 'tcx, R> {
impl<'tcx, R: ResolverAstLoweringExt<'tcx>> SelfResolver<'_, R> {
fn try_replace_id(&mut self, id: NodeId) {
if let Some(res) = self.resolver.get_partial_res(id)
&& let Some(Res::Local(sig_id)) = res.full_res()
Expand All @@ -692,7 +689,7 @@ impl<'tcx, R: ResolverAstLoweringExt<'tcx>> SelfResolver<'_, 'tcx, R> {
}
}

impl<'ast, 'a, 'tcx, R: ResolverAstLoweringExt<'tcx>> Visitor<'ast> for SelfResolver<'a, 'tcx, R> {
impl<'ast, 'tcx, R: ResolverAstLoweringExt<'tcx>> Visitor<'ast> for SelfResolver<'_, R> {
fn visit_id(&mut self, id: NodeId) {
self.try_replace_id(id);
}
Expand Down
Loading