Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot
Simplify visitors more A successor to #100392. r? `@cjgillot`
This commit is contained in:
commit
a0d1df4a5d
26 changed files with 115 additions and 156 deletions
|
@ -154,7 +154,7 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
|
|||
}
|
||||
}
|
||||
|
||||
visit::walk_fn(self, fn_kind, span);
|
||||
visit::walk_fn(self, fn_kind);
|
||||
}
|
||||
|
||||
fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {
|
||||
|
|
|
@ -1030,7 +1030,7 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
|
|||
if let Some(ref gen_args) = constraint.gen_args {
|
||||
// Forbid anonymous lifetimes in GAT parameters until proper semantics are decided.
|
||||
self.with_lifetime_rib(LifetimeRibKind::AnonymousReportError, |this| {
|
||||
this.visit_generic_args(gen_args.span(), gen_args)
|
||||
this.visit_generic_args(gen_args)
|
||||
});
|
||||
}
|
||||
match constraint.kind {
|
||||
|
@ -1044,10 +1044,10 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'ast PathSegment) {
|
||||
fn visit_path_segment(&mut self, path_segment: &'ast PathSegment) {
|
||||
if let Some(ref args) = path_segment.args {
|
||||
match &**args {
|
||||
GenericArgs::AngleBracketed(..) => visit::walk_generic_args(self, path_span, args),
|
||||
GenericArgs::AngleBracketed(..) => visit::walk_generic_args(self, args),
|
||||
GenericArgs::Parenthesized(p_args) => {
|
||||
// Probe the lifetime ribs to know how to behave.
|
||||
for rib in self.lifetime_ribs.iter().rev() {
|
||||
|
@ -1078,7 +1078,7 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
|
|||
// We have nowhere to introduce generics. Code is malformed,
|
||||
// so use regular lifetime resolution to avoid spurious errors.
|
||||
LifetimeRibKind::Item | LifetimeRibKind::Generics { .. } => {
|
||||
visit::walk_generic_args(self, path_span, args);
|
||||
visit::walk_generic_args(self, args);
|
||||
break;
|
||||
}
|
||||
LifetimeRibKind::AnonymousCreateParameter { .. }
|
||||
|
@ -3798,7 +3798,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
|||
for argument in arguments {
|
||||
self.resolve_expr(argument, None);
|
||||
}
|
||||
self.visit_path_segment(expr.span, segment);
|
||||
self.visit_path_segment(segment);
|
||||
}
|
||||
|
||||
ExprKind::Call(ref callee, ref arguments) => {
|
||||
|
|
|
@ -682,7 +682,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
let scope = Scope::TraitRefBoundary { s: self.scope };
|
||||
self.with(scope, |this| {
|
||||
for bound in bounds {
|
||||
this.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
|
||||
this.visit_poly_trait_ref(bound);
|
||||
}
|
||||
});
|
||||
match lifetime.name {
|
||||
|
@ -1105,11 +1105,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_poly_trait_ref(
|
||||
&mut self,
|
||||
trait_ref: &'tcx hir::PolyTraitRef<'tcx>,
|
||||
_modifier: hir::TraitBoundModifier,
|
||||
) {
|
||||
fn visit_poly_trait_ref(&mut self, trait_ref: &'tcx hir::PolyTraitRef<'tcx>) {
|
||||
debug!("visit_poly_trait_ref(trait_ref={:?})", trait_ref);
|
||||
|
||||
let (mut binders, scope_type) = self.poly_trait_ref_binder_info();
|
||||
|
@ -1827,7 +1823,7 @@ fn is_late_bound_map(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<&FxIndexSet<
|
|||
// is, those would be potentially inputs to
|
||||
// projections
|
||||
if let Some(last_segment) = path.segments.last() {
|
||||
self.visit_path_segment(path.span, last_segment);
|
||||
self.visit_path_segment(last_segment);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue