Rename walk_crate.
This commit is contained in:
parent
df148e4efb
commit
d119a13137
11 changed files with 14 additions and 14 deletions
|
@ -451,7 +451,7 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
|
||||||
// since the root module isn't visited as an item (because it isn't an
|
// since the root module isn't visited as an item (because it isn't an
|
||||||
// item), warn for it here.
|
// item), warn for it here.
|
||||||
lint_callback!(cx, check_crate, krate);
|
lint_callback!(cx, check_crate, krate);
|
||||||
tcx.hir().walk_crate(cx);
|
tcx.hir().walk_toplevel_module(cx);
|
||||||
tcx.hir().walk_attributes(cx);
|
tcx.hir().walk_attributes(cx);
|
||||||
lint_callback!(cx, check_crate_post, krate);
|
lint_callback!(cx, check_crate_post, krate);
|
||||||
})
|
})
|
||||||
|
|
|
@ -37,7 +37,7 @@ fn lint_levels(tcx: TyCtxt<'_>, (): ()) -> LintLevelMap {
|
||||||
|
|
||||||
let push = builder.levels.push(tcx.hir().attrs(hir::CRATE_HIR_ID), &store, true);
|
let push = builder.levels.push(tcx.hir().attrs(hir::CRATE_HIR_ID), &store, true);
|
||||||
builder.levels.register_id(hir::CRATE_HIR_ID);
|
builder.levels.register_id(hir::CRATE_HIR_ID);
|
||||||
tcx.hir().walk_crate(&mut builder);
|
tcx.hir().walk_toplevel_module(&mut builder);
|
||||||
builder.levels.pop(push);
|
builder.levels.pop(push);
|
||||||
|
|
||||||
builder.levels.build_map()
|
builder.levels.build_map()
|
||||||
|
|
|
@ -520,7 +520,7 @@ impl<'hir> Map<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Walks the contents of a crate. See also `Crate::visit_all_items`.
|
/// Walks the contents of a crate. See also `Crate::visit_all_items`.
|
||||||
pub fn walk_crate(self, visitor: &mut impl Visitor<'hir>) {
|
pub fn walk_toplevel_module(self, visitor: &mut impl Visitor<'hir>) {
|
||||||
let (top_mod, span, hir_id) = self.get_module(CRATE_DEF_ID);
|
let (top_mod, span, hir_id) = self.get_module(CRATE_DEF_ID);
|
||||||
visitor.visit_mod(top_mod, span, hir_id);
|
visitor.visit_mod(top_mod, span, hir_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,5 +775,5 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||||
let krate = tcx.hir().krate();
|
let krate = tcx.hir().krate();
|
||||||
let live_symbols = find_live(tcx, access_levels, krate);
|
let live_symbols = find_live(tcx, access_levels, krate);
|
||||||
let mut visitor = DeadVisitor { tcx, live_symbols };
|
let mut visitor = DeadVisitor { tcx, live_symbols };
|
||||||
tcx.hir().walk_crate(&mut visitor);
|
tcx.hir().walk_toplevel_module(&mut visitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn print_hir_stats(tcx: TyCtxt<'_>) {
|
||||||
data: FxHashMap::default(),
|
data: FxHashMap::default(),
|
||||||
seen: FxHashSet::default(),
|
seen: FxHashSet::default(),
|
||||||
};
|
};
|
||||||
tcx.hir().walk_crate(&mut collector);
|
tcx.hir().walk_toplevel_module(&mut collector);
|
||||||
tcx.hir().walk_attributes(&mut collector);
|
tcx.hir().walk_attributes(&mut collector);
|
||||||
collector.print("HIR STATS");
|
collector.print("HIR STATS");
|
||||||
}
|
}
|
||||||
|
|
|
@ -717,7 +717,7 @@ fn stability_index(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> {
|
||||||
InheritDeprecation::Yes,
|
InheritDeprecation::Yes,
|
||||||
InheritConstStability::No,
|
InheritConstStability::No,
|
||||||
InheritStability::No,
|
InheritStability::No,
|
||||||
|v| tcx.hir().walk_crate(v),
|
|v| tcx.hir().walk_toplevel_module(v),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
index
|
index
|
||||||
|
@ -909,7 +909,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
|
||||||
let krate = tcx.hir().krate();
|
let krate = tcx.hir().krate();
|
||||||
let mut missing = MissingStabilityAnnotations { tcx, access_levels };
|
let mut missing = MissingStabilityAnnotations { tcx, access_levels };
|
||||||
missing.check_missing_stability(CRATE_DEF_ID, tcx.hir().span(CRATE_HIR_ID));
|
missing.check_missing_stability(CRATE_DEF_ID, tcx.hir().span(CRATE_HIR_ID));
|
||||||
tcx.hir().walk_crate(&mut missing);
|
tcx.hir().walk_toplevel_module(&mut missing);
|
||||||
krate.visit_all_item_likes(&mut missing.as_deep_visitor());
|
krate.visit_all_item_likes(&mut missing.as_deep_visitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2169,7 +2169,7 @@ fn privacy_access_levels(tcx: TyCtxt<'_>, (): ()) -> &AccessLevels {
|
||||||
changed: false,
|
changed: false,
|
||||||
};
|
};
|
||||||
loop {
|
loop {
|
||||||
tcx.hir().walk_crate(&mut visitor);
|
tcx.hir().walk_toplevel_module(&mut visitor);
|
||||||
if visitor.changed {
|
if visitor.changed {
|
||||||
visitor.changed = false;
|
visitor.changed = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2192,11 +2192,11 @@ fn check_private_in_public(tcx: TyCtxt<'_>, (): ()) {
|
||||||
in_variant: false,
|
in_variant: false,
|
||||||
old_error_set: Default::default(),
|
old_error_set: Default::default(),
|
||||||
};
|
};
|
||||||
tcx.hir().walk_crate(&mut visitor);
|
tcx.hir().walk_toplevel_module(&mut visitor);
|
||||||
|
|
||||||
let has_pub_restricted = {
|
let has_pub_restricted = {
|
||||||
let mut pub_restricted_visitor = PubRestrictedVisitor { tcx, has_pub_restricted: false };
|
let mut pub_restricted_visitor = PubRestrictedVisitor { tcx, has_pub_restricted: false };
|
||||||
tcx.hir().walk_crate(&mut pub_restricted_visitor);
|
tcx.hir().walk_toplevel_module(&mut pub_restricted_visitor);
|
||||||
pub_restricted_visitor.has_pub_restricted
|
pub_restricted_visitor.has_pub_restricted
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ impl<'tcx> DumpVisitor<'tcx> {
|
||||||
attributes: lower_attributes(attrs.to_owned(), &self.save_ctxt),
|
attributes: lower_attributes(attrs.to_owned(), &self.save_ctxt),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
self.tcx.hir().walk_crate(self);
|
self.tcx.hir().walk_toplevel_module(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_bounds(&mut self, bounds: hir::GenericBounds<'tcx>) {
|
fn process_bounds(&mut self, bounds: hir::GenericBounds<'tcx>) {
|
||||||
|
|
|
@ -691,7 +691,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
||||||
debug!("find_opaque_ty_constraints: scope={:?}", scope);
|
debug!("find_opaque_ty_constraints: scope={:?}", scope);
|
||||||
|
|
||||||
if scope == hir::CRATE_HIR_ID {
|
if scope == hir::CRATE_HIR_ID {
|
||||||
tcx.hir().walk_crate(&mut locator);
|
tcx.hir().walk_toplevel_module(&mut locator);
|
||||||
} else {
|
} else {
|
||||||
debug!("find_opaque_ty_constraints: scope={:?}", tcx.hir().get(scope));
|
debug!("find_opaque_ty_constraints: scope={:?}", tcx.hir().get(scope));
|
||||||
match tcx.hir().get(scope) {
|
match tcx.hir().get(scope) {
|
||||||
|
|
|
@ -144,7 +144,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
|
||||||
"".to_string(),
|
"".to_string(),
|
||||||
CRATE_HIR_ID,
|
CRATE_HIR_ID,
|
||||||
tcx.hir().span(CRATE_HIR_ID),
|
tcx.hir().span(CRATE_HIR_ID),
|
||||||
|this| tcx.hir().walk_crate(this),
|
|this| tcx.hir().walk_toplevel_module(this),
|
||||||
);
|
);
|
||||||
|
|
||||||
collector
|
collector
|
||||||
|
|
|
@ -45,7 +45,7 @@ crate fn collect_spans_and_sources(
|
||||||
|
|
||||||
if include_sources {
|
if include_sources {
|
||||||
if generate_link_to_definition {
|
if generate_link_to_definition {
|
||||||
tcx.hir().walk_crate(&mut visitor);
|
tcx.hir().walk_toplevel_module(&mut visitor);
|
||||||
}
|
}
|
||||||
let (krate, sources) = sources::collect_local_sources(tcx, src_root, krate);
|
let (krate, sources) = sources::collect_local_sources(tcx, src_root, krate);
|
||||||
(krate, sources, visitor.matches)
|
(krate, sources, visitor.matches)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue