Feed crate_name
query
This commit is contained in:
parent
408ae0fcb9
commit
194b4a2adb
@ -823,7 +823,6 @@ pub fn create_global_ctxt<'tcx>(
|
|||||||
queries.on_disk_cache.as_ref().map(OnDiskCache::as_dyn),
|
queries.on_disk_cache.as_ref().map(OnDiskCache::as_dyn),
|
||||||
queries.as_dyn(),
|
queries.as_dyn(),
|
||||||
rustc_query_impl::query_callbacks(arena),
|
rustc_query_impl::query_callbacks(arena),
|
||||||
crate_name,
|
|
||||||
outputs,
|
outputs,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -834,6 +833,8 @@ pub fn create_global_ctxt<'tcx>(
|
|||||||
let feed = tcx.feed_unit_query();
|
let feed = tcx.feed_unit_query();
|
||||||
feed.resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering)));
|
feed.resolver_for_lowering(tcx.arena.alloc(Steal::new(untracked_resolver_for_lowering)));
|
||||||
feed.resolutions(tcx.arena.alloc(untracked_resolutions));
|
feed.resolutions(tcx.arena.alloc(untracked_resolutions));
|
||||||
|
let feed = tcx.feed_local_crate();
|
||||||
|
feed.crate_name(crate_name);
|
||||||
});
|
});
|
||||||
qcx
|
qcx
|
||||||
}
|
}
|
||||||
|
@ -1673,7 +1673,7 @@ rustc_queries! {
|
|||||||
|
|
||||||
/// Gets the name of the crate.
|
/// Gets the name of the crate.
|
||||||
query crate_name(_: CrateNum) -> Symbol {
|
query crate_name(_: CrateNum) -> Symbol {
|
||||||
eval_always
|
feedable
|
||||||
desc { "fetching what a crate is named" }
|
desc { "fetching what a crate is named" }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
}
|
}
|
||||||
|
@ -363,6 +363,9 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
pub fn feed_unit_query(self) -> TyCtxtFeed<'tcx, ()> {
|
pub fn feed_unit_query(self) -> TyCtxtFeed<'tcx, ()> {
|
||||||
TyCtxtFeed { tcx: self, key: () }
|
TyCtxtFeed { tcx: self, key: () }
|
||||||
}
|
}
|
||||||
|
pub fn feed_local_crate(self) -> TyCtxtFeed<'tcx, CrateNum> {
|
||||||
|
TyCtxtFeed { tcx: self, key: LOCAL_CRATE }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, KEY: Copy> TyCtxtFeed<'tcx, KEY> {
|
impl<'tcx, KEY: Copy> TyCtxtFeed<'tcx, KEY> {
|
||||||
@ -456,10 +459,6 @@ pub struct GlobalCtxt<'tcx> {
|
|||||||
/// Merge this with `selection_cache`?
|
/// Merge this with `selection_cache`?
|
||||||
pub evaluation_cache: traits::EvaluationCache<'tcx>,
|
pub evaluation_cache: traits::EvaluationCache<'tcx>,
|
||||||
|
|
||||||
/// The definite name of the current crate after taking into account
|
|
||||||
/// attributes, commandline parameters, etc.
|
|
||||||
crate_name: Symbol,
|
|
||||||
|
|
||||||
/// Data layout specification for the current target.
|
/// Data layout specification for the current target.
|
||||||
pub data_layout: TargetDataLayout,
|
pub data_layout: TargetDataLayout,
|
||||||
|
|
||||||
@ -597,7 +596,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
on_disk_cache: Option<&'tcx dyn OnDiskCache<'tcx>>,
|
on_disk_cache: Option<&'tcx dyn OnDiskCache<'tcx>>,
|
||||||
queries: &'tcx dyn query::QueryEngine<'tcx>,
|
queries: &'tcx dyn query::QueryEngine<'tcx>,
|
||||||
query_kinds: &'tcx [DepKindStruct<'tcx>],
|
query_kinds: &'tcx [DepKindStruct<'tcx>],
|
||||||
crate_name: Symbol,
|
|
||||||
output_filenames: OutputFilenames,
|
output_filenames: OutputFilenames,
|
||||||
) -> GlobalCtxt<'tcx> {
|
) -> GlobalCtxt<'tcx> {
|
||||||
let data_layout = s.target.parse_data_layout().unwrap_or_else(|err| {
|
let data_layout = s.target.parse_data_layout().unwrap_or_else(|err| {
|
||||||
@ -629,7 +627,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
pred_rcache: Default::default(),
|
pred_rcache: Default::default(),
|
||||||
selection_cache: Default::default(),
|
selection_cache: Default::default(),
|
||||||
evaluation_cache: Default::default(),
|
evaluation_cache: Default::default(),
|
||||||
crate_name,
|
|
||||||
data_layout,
|
data_layout,
|
||||||
alloc_map: Lock::new(interpret::AllocMap::new()),
|
alloc_map: Lock::new(interpret::AllocMap::new()),
|
||||||
output_filenames: Arc::new(output_filenames),
|
output_filenames: Arc::new(output_filenames),
|
||||||
@ -807,7 +804,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
// statements within the query system and we'd run into endless
|
// statements within the query system and we'd run into endless
|
||||||
// recursion otherwise.
|
// recursion otherwise.
|
||||||
let (crate_name, stable_crate_id) = if def_id.is_local() {
|
let (crate_name, stable_crate_id) = if def_id.is_local() {
|
||||||
(self.crate_name, self.sess.local_stable_crate_id())
|
(self.crate_name(LOCAL_CRATE), self.sess.local_stable_crate_id())
|
||||||
} else {
|
} else {
|
||||||
let cstore = &*self.untracked.cstore;
|
let cstore = &*self.untracked.cstore;
|
||||||
(cstore.crate_name(def_id.krate), cstore.stable_crate_id(def_id.krate))
|
(cstore.crate_name(def_id.krate), cstore.stable_crate_id(def_id.krate))
|
||||||
@ -2406,10 +2403,6 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {
|
|||||||
pub fn provide(providers: &mut ty::query::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
providers.module_reexports =
|
providers.module_reexports =
|
||||||
|tcx, id| tcx.resolutions(()).reexport_map.get(&id).map(|v| &v[..]);
|
|tcx, id| tcx.resolutions(()).reexport_map.get(&id).map(|v| &v[..]);
|
||||||
providers.crate_name = |tcx, id| {
|
|
||||||
assert_eq!(id, LOCAL_CRATE);
|
|
||||||
tcx.crate_name
|
|
||||||
};
|
|
||||||
providers.maybe_unused_trait_imports =
|
providers.maybe_unused_trait_imports =
|
||||||
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
|
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
|
||||||
providers.maybe_unused_extern_crates =
|
providers.maybe_unused_extern_crates =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user