Skip to content

Commit

Permalink
Rename walk_crate.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Sep 2, 2021
1 parent df148e4 commit d119a13
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
// item), warn for it here.
lint_callback!(cx, check_crate, krate);
tcx.hir().walk_crate(cx);
tcx.hir().walk_toplevel_module(cx);
tcx.hir().walk_attributes(cx);
lint_callback!(cx, check_crate_post, krate);
})
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn lint_levels(tcx: TyCtxt<'_>, (): ()) -> LintLevelMap {

let push = builder.levels.push(tcx.hir().attrs(hir::CRATE_HIR_ID), &store, true);
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.build_map()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl<'hir> Map<'hir> {
}

/// 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);
visitor.visit_mod(top_mod, span, hir_id);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,5 +775,5 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
let krate = tcx.hir().krate();
let live_symbols = find_live(tcx, access_levels, krate);
let mut visitor = DeadVisitor { tcx, live_symbols };
tcx.hir().walk_crate(&mut visitor);
tcx.hir().walk_toplevel_module(&mut visitor);
}
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/hir_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn print_hir_stats(tcx: TyCtxt<'_>) {
data: FxHashMap::default(),
seen: FxHashSet::default(),
};
tcx.hir().walk_crate(&mut collector);
tcx.hir().walk_toplevel_module(&mut collector);
tcx.hir().walk_attributes(&mut collector);
collector.print("HIR STATS");
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ fn stability_index(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> {
InheritDeprecation::Yes,
InheritConstStability::No,
InheritStability::No,
|v| tcx.hir().walk_crate(v),
|v| tcx.hir().walk_toplevel_module(v),
);
}
index
Expand Down Expand Up @@ -909,7 +909,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
let krate = tcx.hir().krate();
let mut missing = MissingStabilityAnnotations { tcx, access_levels };
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());
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2169,7 +2169,7 @@ fn privacy_access_levels(tcx: TyCtxt<'_>, (): ()) -> &AccessLevels {
changed: false,
};
loop {
tcx.hir().walk_crate(&mut visitor);
tcx.hir().walk_toplevel_module(&mut visitor);
if visitor.changed {
visitor.changed = false;
} else {
Expand All @@ -2192,11 +2192,11 @@ fn check_private_in_public(tcx: TyCtxt<'_>, (): ()) {
in_variant: false,
old_error_set: Default::default(),
};
tcx.hir().walk_crate(&mut visitor);
tcx.hir().walk_toplevel_module(&mut visitor);

let has_pub_restricted = {
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
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_save_analysis/src/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ impl<'tcx> DumpVisitor<'tcx> {
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>) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
debug!("find_opaque_ty_constraints: scope={:?}", scope);

if scope == hir::CRATE_HIR_ID {
tcx.hir().walk_crate(&mut locator);
tcx.hir().walk_toplevel_module(&mut locator);
} else {
debug!("find_opaque_ty_constraints: scope={:?}", tcx.hir().get(scope));
match tcx.hir().get(scope) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
"".to_string(),
CRATE_HIR_ID,
tcx.hir().span(CRATE_HIR_ID),
|this| tcx.hir().walk_crate(this),
|this| tcx.hir().walk_toplevel_module(this),
);

collector
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/span_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ crate fn collect_spans_and_sources(

if include_sources {
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);
(krate, sources, visitor.matches)
Expand Down

0 comments on commit d119a13

Please sign in to comment.