Skip to content

Commit 6a89f1c

Browse files
committed
rustc: Migrate CStore::expored_symbols to a query
1 parent fc91ea1 commit 6a89f1c

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ define_dep_nodes!( <'tcx>
531531
[] GetPanicStrategy(CrateNum),
532532
[] IsNoBuiltins(CrateNum),
533533
[] ImplDefaultness(DefId),
534+
[] ExportedSymbols(CrateNum),
534535
);
535536

536537
trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {

src/librustc/middle/cstore.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ pub trait CrateStore {
258258
fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
259259
fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
260260
fn native_libraries(&self, cnum: CrateNum) -> Vec<NativeLibrary>;
261-
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId>;
262261

263262
// resolve
264263
fn def_key(&self, def: DefId) -> DefKey;
@@ -367,7 +366,6 @@ impl CrateStore for DummyCrateStore {
367366
{ bug!("derive_registrar_fn") }
368367
fn native_libraries(&self, cnum: CrateNum) -> Vec<NativeLibrary>
369368
{ bug!("native_libraries") }
370-
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId> { bug!("exported_symbols") }
371369

372370
// resolve
373371
fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") }

src/librustc/ty/maps.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,12 @@ impl<'tcx> QueryDescription for queries::is_sanitizer_runtime<'tcx> {
559559
}
560560
}
561561

562+
impl<'tcx> QueryDescription for queries::exported_symbols<'tcx> {
563+
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
564+
format!("looking up the exported symbols of a crate")
565+
}
566+
}
567+
562568
// If enabled, send a message to the profile-queries thread
563569
macro_rules! profq_msg {
564570
($tcx:expr, $msg:expr) => {
@@ -1132,6 +1138,7 @@ define_maps! { <'tcx>
11321138
[] lint_levels: lint_levels_node(CrateNum) -> Rc<lint::LintLevelMap>,
11331139

11341140
[] impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
1141+
[] exported_symbols: ExportedSymbols(CrateNum) -> Rc<Vec<DefId>>,
11351142
}
11361143

11371144
fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {

src/librustc_metadata/cstore_impl.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ provide! { <'tcx> tcx, def_id, cdata,
160160
extern_crate => { Rc::new(cdata.extern_crate.get()) }
161161
is_no_builtins => { cdata.is_no_builtins(&tcx.dep_graph) }
162162
impl_defaultness => { cdata.get_impl_defaultness(def_id.index) }
163+
exported_symbols => { Rc::new(cdata.get_exported_symbols(&tcx.dep_graph)) }
163164
}
164165

165166
pub fn provide_local<'tcx>(providers: &mut Providers<'tcx>) {
@@ -299,11 +300,6 @@ impl CrateStore for cstore::CStore {
299300
self.get_crate_data(cnum).get_native_libraries(&self.dep_graph)
300301
}
301302

302-
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId>
303-
{
304-
self.get_crate_data(cnum).get_exported_symbols(&self.dep_graph)
305-
}
306-
307303
/// Returns the `DefKey` for a given `DefId`. This indicates the
308304
/// parent `DefId` as well as some idea of what kind of data the
309305
/// `DefId` refers to.

src/librustc_trans/back/symbol_export.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ impl ExportedSymbols {
131131
tcx.is_panic_runtime(cnum) || tcx.is_compiler_builtins(cnum);
132132

133133
let crate_exports = tcx
134-
.sess
135-
.cstore
136134
.exported_symbols(cnum)
137135
.iter()
138136
.map(|&def_id| {

0 commit comments

Comments
 (0)