Remove path_span
argument to the visit_path_segment
methods.
The `visit_path_segment` method of both the AST and HIR visitors has a `path_span` argument that isn't necessary. This commit removes it. There are two very small and inconsequential functional changes. - One call to `NodeCollector::insert` now is passed a path segment identifier span instead of a full path span. This span is only used in a panic message printed in the case of an internal compiler bug. - Likewise, one call to `LifetimeCollectVisitor::record_elided_anchor` now uses a path segment identifier span instead of a full path span. This span is used to make some `'_` lifetimes.
This commit is contained in:
parent
59e7a308e4
commit
6568ef338e
13 changed files with 57 additions and 75 deletions
|
@ -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) => {
|
||||
|
|
|
@ -1827,7 +1827,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