mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
rustc_hir: Relax lifetime requirements on Visitor::visit_path
This commit is contained in:
parent
9c0bc3028a
commit
6cd4dd3091
@ -422,7 +422,7 @@ pub trait Visitor<'v>: Sized {
|
||||
fn visit_qpath(&mut self, qpath: &'v QPath<'v>, id: HirId, _span: Span) {
|
||||
walk_qpath(self, qpath, id)
|
||||
}
|
||||
fn visit_path(&mut self, path: &'v Path<'v>, _id: HirId) {
|
||||
fn visit_path(&mut self, path: &Path<'v>, _id: HirId) {
|
||||
walk_path(self, path)
|
||||
}
|
||||
fn visit_path_segment(&mut self, path_segment: &'v PathSegment<'v>) {
|
||||
@ -1126,7 +1126,7 @@ pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath<'v>, id:
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path<'v>) {
|
||||
pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &Path<'v>) {
|
||||
for segment in path.segments {
|
||||
visitor.visit_path_segment(segment);
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) {
|
||||
for (i, segment) in path.segments.iter().enumerate() {
|
||||
let depth = path.segments.len() - i - 1;
|
||||
if let Some(ref args) = segment.args {
|
||||
|
@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
|
||||
fn check_path(
|
||||
&mut self,
|
||||
cx: &LateContext<'tcx>,
|
||||
path: &'tcx rustc_hir::Path<'tcx>,
|
||||
path: &rustc_hir::Path<'tcx>,
|
||||
_: rustc_hir::HirId,
|
||||
) {
|
||||
if let Some(segment) = path.segments.iter().nth_back(1)
|
||||
|
@ -292,7 +292,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
|
||||
hir_visit::walk_lifetime(self, lt);
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, p: &'tcx hir::Path<'tcx>, id: hir::HirId) {
|
||||
fn visit_path(&mut self, p: &hir::Path<'tcx>, id: hir::HirId) {
|
||||
lint_callback!(self, check_path, p, id);
|
||||
hir_visit::walk_path(self, p);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ macro_rules! late_lint_methods {
|
||||
fn check_struct_def(a: &$hir hir::VariantData<$hir>);
|
||||
fn check_field_def(a: &$hir hir::FieldDef<$hir>);
|
||||
fn check_variant(a: &$hir hir::Variant<$hir>);
|
||||
fn check_path(a: &$hir hir::Path<$hir>, b: hir::HirId);
|
||||
fn check_path(a: &hir::Path<$hir>, b: hir::HirId);
|
||||
fn check_attribute(a: &$hir ast::Attribute);
|
||||
|
||||
/// Called when entering a syntax node that can have lint attributes such
|
||||
|
@ -433,7 +433,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
|
||||
self.in_pat = false;
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) {
|
||||
self.handle_res(path.res);
|
||||
intravisit::walk_path(self, path);
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
hir_visit::walk_lifetime(self, lifetime)
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'v hir::Path<'v>, _id: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'v>, _id: hir::HirId) {
|
||||
self.record("Path", Id::None, path);
|
||||
hir_visit::walk_path(self, path)
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
|
||||
intravisit::walk_item(self, item);
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, id: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'tcx>, id: hir::HirId) {
|
||||
if let Some(def_id) = path.res.opt_def_id() {
|
||||
let method_span = path.segments.last().map(|s| s.ident.span);
|
||||
let item_is_allowed = self.tcx.check_stability_allow_unstable(
|
||||
@ -880,7 +880,7 @@ struct CheckTraitImplStable<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _id: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'tcx>, _id: hir::HirId) {
|
||||
if let Some(def_id) = path.res.opt_def_id() {
|
||||
if let Some(stab) = self.tcx.lookup_stability(def_id) {
|
||||
self.fully_stable &= stab.level.is_stable();
|
||||
|
@ -66,7 +66,7 @@ impl CaptureCollector<'_, '_> {
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for CaptureCollector<'_, 'tcx> {
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) {
|
||||
if let Res::Local(var_id) = path.res {
|
||||
self.visit_local_use(var_id, path.span);
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ impl<'tcx> Visitor<'tcx> for EmitIgnoredResolutionErrors<'tcx> {
|
||||
self.tcx.hir()
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx Path<'_>, _id: HirId) {
|
||||
fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) {
|
||||
debug!("visiting path {:?}", path);
|
||||
if path.res == Res::Err {
|
||||
// We have less context here than in rustc_resolve,
|
||||
|
@ -140,7 +140,7 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> {
|
||||
self.tcx.hir()
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx rustc_hir::Path<'tcx>, _id: HirId) {
|
||||
fn visit_path(&mut self, path: &rustc_hir::Path<'tcx>, _id: HirId) {
|
||||
if self.handle_macro(path.span) {
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SelfFinder<'a, 'tcx> {
|
||||
self.cx.tcx.hir()
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx Path<'tcx>, _id: HirId) {
|
||||
fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) {
|
||||
for segment in path.segments {
|
||||
match segment.ident.name {
|
||||
kw::SelfLower => self.lower.push(segment.ident.span),
|
||||
|
@ -97,7 +97,7 @@ struct UnwrapVisitor<'a, 'tcx> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
|
||||
type NestedFilter = nested_filter::All;
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx Path<'_>, _id: HirId) {
|
||||
fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) {
|
||||
self.identifiers.insert(ident(path));
|
||||
walk_path(self, path);
|
||||
}
|
||||
@ -116,7 +116,7 @@ struct MapExprVisitor<'a, 'tcx> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
|
||||
type NestedFilter = nested_filter::All;
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx Path<'_>, _id: HirId) {
|
||||
fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) {
|
||||
if self.identifiers.contains(&ident(path)) {
|
||||
self.found_identifier = true;
|
||||
return;
|
||||
|
@ -330,7 +330,7 @@ struct LintCollector<'a, 'tcx> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LintCollector<'a, 'tcx> {
|
||||
type NestedFilter = nested_filter::All;
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx Path<'_>, _: HirId) {
|
||||
fn visit_path(&mut self, path: &Path<'_>, _: HirId) {
|
||||
if path.segments.len() == 1 {
|
||||
self.output.insert(path.segments[0].ident.name);
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for ApplicabilityResolver<'a, 'hir> {
|
||||
self.cx.tcx.hir()
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'hir hir::Path<'hir>, _id: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'hir>, _id: hir::HirId) {
|
||||
for (index, enum_value) in paths::APPLICABILITY_VALUES.iter().enumerate() {
|
||||
if match_path(path, enum_value) {
|
||||
self.add_new_index(index);
|
||||
|
@ -128,7 +128,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for BindingUsageFinder<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) {
|
||||
if let hir::def::Res::Local(id) = path.res {
|
||||
if self.binding_ids.contains(&id) {
|
||||
self.usage_found = true;
|
||||
|
Loading…
Reference in New Issue
Block a user