Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't explicitly track crate_name getters #85837

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ provide! { <'tcx> tcx, def_id, other, cdata,
foreign_modules => { cdata.get_foreign_modules(tcx) }
crate_hash => { cdata.root.hash }
crate_host_hash => { cdata.host_hash }
crate_name => { cdata.root.name }

extra_filename => { cdata.root.extra_filename.clone() }

Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,10 +1360,6 @@ rustc_queries! {
eval_always
desc { "fetching what a dependency looks like" }
}
query crate_name(_: CrateNum) -> Symbol {
eval_always
desc { "fetching what a crate is named" }
}
query item_children(def_id: DefId) -> &'tcx [Export<hir::HirId>] {
desc { |tcx| "collecting child items of `{}`", tcx.def_path_str(def_id) }
}
Expand Down
14 changes: 10 additions & 4 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,16 @@ impl<'tcx> TyCtxt<'tcx> {
}
}

#[inline]
pub fn crate_name(self, crate_num: CrateNum) -> Symbol {
// Note: Changing the local crate name will invalidate the incremental caches
if crate_num == LOCAL_CRATE {
self.crate_name
} else {
self.untracked_resolutions.cstore.crate_name(crate_num)
}
}

#[inline]
pub fn stable_crate_id(self, crate_num: CrateNum) -> StableCrateId {
if crate_num == LOCAL_CRATE {
Expand Down Expand Up @@ -2842,10 +2852,6 @@ pub fn provide(providers: &mut ty::query::Providers) {
providers.in_scope_traits_map = |tcx, id| tcx.hir_crate(()).trait_map.get(&id);
providers.resolutions = |tcx, ()| &tcx.untracked_resolutions;
providers.module_exports = |tcx, id| tcx.resolutions(()).export_map.get(&id).map(|v| &v[..]);
providers.crate_name = |tcx, id| {
assert_eq!(id, LOCAL_CRATE);
tcx.crate_name
};
providers.maybe_unused_trait_import =
|tcx, id| tcx.resolutions(()).maybe_unused_trait_imports.contains(&id);
providers.maybe_unused_extern_crates =
Expand Down