mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
metadata: Remove some more untracked CStore
methods
This commit is contained in:
parent
b3ee735993
commit
98cce81917
@ -26,7 +26,7 @@ use rustc_plugin_impl as plugin;
|
|||||||
use rustc_query_impl::{OnDiskCache, Queries as TcxQueries};
|
use rustc_query_impl::{OnDiskCache, Queries as TcxQueries};
|
||||||
use rustc_resolve::Resolver;
|
use rustc_resolve::Resolver;
|
||||||
use rustc_session::config::{CrateType, Input, OutputFilenames, OutputType};
|
use rustc_session::config::{CrateType, Input, OutputFilenames, OutputType};
|
||||||
use rustc_session::cstore::{CrateStoreDyn, MetadataLoader, Untracked};
|
use rustc_session::cstore::{MetadataLoader, Untracked};
|
||||||
use rustc_session::output::filename_for_input;
|
use rustc_session::output::filename_for_input;
|
||||||
use rustc_session::search_paths::PathKind;
|
use rustc_session::search_paths::PathKind;
|
||||||
use rustc_session::{Limit, Session};
|
use rustc_session::{Limit, Session};
|
||||||
@ -442,13 +442,9 @@ fn escape_dep_env(symbol: Symbol) -> String {
|
|||||||
escaped
|
escaped
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_out_deps(
|
fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[PathBuf]) {
|
||||||
sess: &Session,
|
|
||||||
cstore: &CrateStoreDyn,
|
|
||||||
outputs: &OutputFilenames,
|
|
||||||
out_filenames: &[PathBuf],
|
|
||||||
) {
|
|
||||||
// Write out dependency rules to the dep-info file if requested
|
// Write out dependency rules to the dep-info file if requested
|
||||||
|
let sess = tcx.sess;
|
||||||
if !sess.opts.output_types.contains_key(&OutputType::DepInfo) {
|
if !sess.opts.output_types.contains_key(&OutputType::DepInfo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -496,9 +492,8 @@ fn write_out_deps(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let cstore = cstore.as_any().downcast_ref::<CStore>().unwrap();
|
for &cnum in tcx.crates(()) {
|
||||||
for cnum in cstore.crates_untracked() {
|
let source = tcx.used_crate_source(cnum);
|
||||||
let source = cstore.crate_source_untracked(cnum);
|
|
||||||
if let Some((path, _)) = &source.dylib {
|
if let Some((path, _)) = &source.dylib {
|
||||||
files.push(escape_dep_filename(&path.display().to_string()));
|
files.push(escape_dep_filename(&path.display().to_string()));
|
||||||
}
|
}
|
||||||
@ -612,7 +607,7 @@ fn output_filenames(tcx: TyCtxt<'_>, (): ()) -> Arc<OutputFilenames> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
write_out_deps(sess, &*tcx.cstore_untracked(), &outputs, &output_paths);
|
write_out_deps(tcx, &outputs, &output_paths);
|
||||||
|
|
||||||
let only_dep_info = sess.opts.output_types.contains_key(&OutputType::DepInfo)
|
let only_dep_info = sess.opts.output_types.contains_key(&OutputType::DepInfo)
|
||||||
&& sess.opts.output_types.len() == 1;
|
&& sess.opts.output_types.len() == 1;
|
||||||
|
@ -16,7 +16,7 @@ use rustc_middle::middle::stability::DeprecationEntry;
|
|||||||
use rustc_middle::ty::fast_reject::SimplifiedType;
|
use rustc_middle::ty::fast_reject::SimplifiedType;
|
||||||
use rustc_middle::ty::query::{ExternProviders, Providers};
|
use rustc_middle::ty::query::{ExternProviders, Providers};
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_session::cstore::{CrateSource, CrateStore};
|
use rustc_session::cstore::CrateStore;
|
||||||
use rustc_session::{Session, StableCrateId};
|
use rustc_session::{Session, StableCrateId};
|
||||||
use rustc_span::hygiene::{ExpnHash, ExpnId};
|
use rustc_span::hygiene::{ExpnHash, ExpnId};
|
||||||
use rustc_span::symbol::{kw, Symbol};
|
use rustc_span::symbol::{kw, Symbol};
|
||||||
@ -501,7 +501,9 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
|
|||||||
tcx.arena
|
tcx.arena
|
||||||
.alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE))
|
.alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE))
|
||||||
},
|
},
|
||||||
crates: |tcx, ()| tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).crates_untracked()),
|
crates: |tcx, ()| {
|
||||||
|
tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).iter_crate_data().map(|(cnum, _)| cnum))
|
||||||
|
},
|
||||||
..*providers
|
..*providers
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -547,10 +549,6 @@ impl CStore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn crate_source_untracked(&self, cnum: CrateNum) -> Lrc<CrateSource> {
|
|
||||||
self.get_crate_data(cnum).source.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_span_untracked(&self, def_id: DefId, sess: &Session) -> Span {
|
pub fn get_span_untracked(&self, def_id: DefId, sess: &Session) -> Span {
|
||||||
self.get_crate_data(def_id.krate).get_span(def_id.index, sess)
|
self.get_crate_data(def_id.krate).get_span(def_id.index, sess)
|
||||||
}
|
}
|
||||||
@ -559,10 +557,6 @@ impl CStore {
|
|||||||
self.get_crate_data(def.krate).def_kind(def.index)
|
self.get_crate_data(def.krate).def_kind(def.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn crates_untracked(&self) -> impl Iterator<Item = CrateNum> + '_ {
|
|
||||||
self.iter_crate_data().map(|(cnum, _)| cnum)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usize {
|
pub fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usize {
|
||||||
self.get_crate_data(def_id.krate).get_generics(def_id.index, sess).own_counts().lifetimes
|
self.get_crate_data(def_id.krate).get_generics(def_id.index, sess).own_counts().lifetimes
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user