From d119a131374b973f0a1ae9d723c3a9ad518b8049 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 2 Sep 2021 19:22:24 +0200 Subject: [PATCH] Rename walk_crate. --- compiler/rustc_lint/src/late.rs | 2 +- compiler/rustc_lint/src/levels.rs | 2 +- compiler/rustc_middle/src/hir/map/mod.rs | 2 +- compiler/rustc_passes/src/dead.rs | 2 +- compiler/rustc_passes/src/hir_stats.rs | 2 +- compiler/rustc_passes/src/stability.rs | 4 ++-- compiler/rustc_privacy/src/lib.rs | 6 +++--- compiler/rustc_save_analysis/src/dump_visitor.rs | 2 +- compiler/rustc_typeck/src/collect/type_of.rs | 2 +- src/librustdoc/doctest.rs | 2 +- src/librustdoc/html/render/span_map.rs | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index fe98bffaaee..2070fd69d3f 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -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); }) diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 267d2aa5382..66966e589e4 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -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() diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 3403fff7551..e0b6039fe34 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -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); } diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index e57446b0003..25ad00aaf1f 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -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); } diff --git a/compiler/rustc_passes/src/hir_stats.rs b/compiler/rustc_passes/src/hir_stats.rs index 58693cdda90..d665c12f762 100644 --- a/compiler/rustc_passes/src/hir_stats.rs +++ b/compiler/rustc_passes/src/hir_stats.rs @@ -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"); } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 9cf12c135a4..b7e43b7785d 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -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 @@ -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()); } diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 4bb13704d93..35e25e52dc5 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -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 { @@ -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 }; diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index 9d00b12d29f..08ed9ec73c8 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -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>) { diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 399ab32b021..7f9afaae0ea 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -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) { diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 1554e4d9ef2..e6097f5cad7 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -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 diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index df31de50434..54476d9c9a4 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -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)