Skip to content

Commit d119a13

Browse files
committed
Rename walk_crate.
1 parent df148e4 commit d119a13

File tree

11 files changed

+14
-14
lines changed

11 files changed

+14
-14
lines changed

compiler/rustc_lint/src/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
451451
// since the root module isn't visited as an item (because it isn't an
452452
// item), warn for it here.
453453
lint_callback!(cx, check_crate, krate);
454-
tcx.hir().walk_crate(cx);
454+
tcx.hir().walk_toplevel_module(cx);
455455
tcx.hir().walk_attributes(cx);
456456
lint_callback!(cx, check_crate_post, krate);
457457
})

compiler/rustc_lint/src/levels.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn lint_levels(tcx: TyCtxt<'_>, (): ()) -> LintLevelMap {
3737

3838
let push = builder.levels.push(tcx.hir().attrs(hir::CRATE_HIR_ID), &store, true);
3939
builder.levels.register_id(hir::CRATE_HIR_ID);
40-
tcx.hir().walk_crate(&mut builder);
40+
tcx.hir().walk_toplevel_module(&mut builder);
4141
builder.levels.pop(push);
4242

4343
builder.levels.build_map()

compiler/rustc_middle/src/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ impl<'hir> Map<'hir> {
520520
}
521521

522522
/// Walks the contents of a crate. See also `Crate::visit_all_items`.
523-
pub fn walk_crate(self, visitor: &mut impl Visitor<'hir>) {
523+
pub fn walk_toplevel_module(self, visitor: &mut impl Visitor<'hir>) {
524524
let (top_mod, span, hir_id) = self.get_module(CRATE_DEF_ID);
525525
visitor.visit_mod(top_mod, span, hir_id);
526526
}

compiler/rustc_passes/src/dead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,5 +775,5 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
775775
let krate = tcx.hir().krate();
776776
let live_symbols = find_live(tcx, access_levels, krate);
777777
let mut visitor = DeadVisitor { tcx, live_symbols };
778-
tcx.hir().walk_crate(&mut visitor);
778+
tcx.hir().walk_toplevel_module(&mut visitor);
779779
}

compiler/rustc_passes/src/hir_stats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn print_hir_stats(tcx: TyCtxt<'_>) {
3737
data: FxHashMap::default(),
3838
seen: FxHashSet::default(),
3939
};
40-
tcx.hir().walk_crate(&mut collector);
40+
tcx.hir().walk_toplevel_module(&mut collector);
4141
tcx.hir().walk_attributes(&mut collector);
4242
collector.print("HIR STATS");
4343
}

compiler/rustc_passes/src/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ fn stability_index(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> {
717717
InheritDeprecation::Yes,
718718
InheritConstStability::No,
719719
InheritStability::No,
720-
|v| tcx.hir().walk_crate(v),
720+
|v| tcx.hir().walk_toplevel_module(v),
721721
);
722722
}
723723
index
@@ -909,7 +909,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
909909
let krate = tcx.hir().krate();
910910
let mut missing = MissingStabilityAnnotations { tcx, access_levels };
911911
missing.check_missing_stability(CRATE_DEF_ID, tcx.hir().span(CRATE_HIR_ID));
912-
tcx.hir().walk_crate(&mut missing);
912+
tcx.hir().walk_toplevel_module(&mut missing);
913913
krate.visit_all_item_likes(&mut missing.as_deep_visitor());
914914
}
915915

compiler/rustc_privacy/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ fn privacy_access_levels(tcx: TyCtxt<'_>, (): ()) -> &AccessLevels {
21692169
changed: false,
21702170
};
21712171
loop {
2172-
tcx.hir().walk_crate(&mut visitor);
2172+
tcx.hir().walk_toplevel_module(&mut visitor);
21732173
if visitor.changed {
21742174
visitor.changed = false;
21752175
} else {
@@ -2192,11 +2192,11 @@ fn check_private_in_public(tcx: TyCtxt<'_>, (): ()) {
21922192
in_variant: false,
21932193
old_error_set: Default::default(),
21942194
};
2195-
tcx.hir().walk_crate(&mut visitor);
2195+
tcx.hir().walk_toplevel_module(&mut visitor);
21962196

21972197
let has_pub_restricted = {
21982198
let mut pub_restricted_visitor = PubRestrictedVisitor { tcx, has_pub_restricted: false };
2199-
tcx.hir().walk_crate(&mut pub_restricted_visitor);
2199+
tcx.hir().walk_toplevel_module(&mut pub_restricted_visitor);
22002200
pub_restricted_visitor.has_pub_restricted
22012201
};
22022202

compiler/rustc_save_analysis/src/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ impl<'tcx> DumpVisitor<'tcx> {
11221122
attributes: lower_attributes(attrs.to_owned(), &self.save_ctxt),
11231123
},
11241124
);
1125-
self.tcx.hir().walk_crate(self);
1125+
self.tcx.hir().walk_toplevel_module(self);
11261126
}
11271127

11281128
fn process_bounds(&mut self, bounds: hir::GenericBounds<'tcx>) {

compiler/rustc_typeck/src/collect/type_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
691691
debug!("find_opaque_ty_constraints: scope={:?}", scope);
692692

693693
if scope == hir::CRATE_HIR_ID {
694-
tcx.hir().walk_crate(&mut locator);
694+
tcx.hir().walk_toplevel_module(&mut locator);
695695
} else {
696696
debug!("find_opaque_ty_constraints: scope={:?}", tcx.hir().get(scope));
697697
match tcx.hir().get(scope) {

src/librustdoc/doctest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
144144
"".to_string(),
145145
CRATE_HIR_ID,
146146
tcx.hir().span(CRATE_HIR_ID),
147-
|this| tcx.hir().walk_crate(this),
147+
|this| tcx.hir().walk_toplevel_module(this),
148148
);
149149

150150
collector

src/librustdoc/html/render/span_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ crate fn collect_spans_and_sources(
4545

4646
if include_sources {
4747
if generate_link_to_definition {
48-
tcx.hir().walk_crate(&mut visitor);
48+
tcx.hir().walk_toplevel_module(&mut visitor);
4949
}
5050
let (krate, sources) = sources::collect_local_sources(tcx, src_root, krate);
5151
(krate, sources, visitor.matches)

0 commit comments

Comments
 (0)