Skip to content

Commit 98b74c5

Browse files
committed
rustc: Migrate CStore::expored_symbols to a query
1 parent ed6f868 commit 98b74c5

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
@@ -535,6 +535,7 @@ define_dep_nodes!( <'tcx>
535535
[] GetPanicStrategy(CrateNum),
536536
[] IsNoBuiltins(CrateNum),
537537
[] ImplDefaultness(DefId),
538+
[] ExportedSymbols(CrateNum),
538539
);
539540

540541
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
@@ -587,6 +587,12 @@ impl<'tcx> QueryDescription for queries::is_sanitizer_runtime<'tcx> {
587587
}
588588
}
589589

590+
impl<'tcx> QueryDescription for queries::exported_symbols<'tcx> {
591+
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
592+
format!("looking up the exported symbols of a crate")
593+
}
594+
}
595+
590596
// If enabled, send a message to the profile-queries thread
591597
macro_rules! profq_msg {
592598
($tcx:expr, $msg:expr) => {
@@ -1163,6 +1169,7 @@ define_maps! { <'tcx>
11631169
[] fn lint_levels: lint_levels_node(CrateNum) -> Rc<lint::LintLevelMap>,
11641170

11651171
[] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
1172+
[] fn exported_symbols: ExportedSymbols(CrateNum) -> Rc<Vec<DefId>>,
11661173
}
11671174

11681175
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
@@ -163,6 +163,7 @@ provide! { <'tcx> tcx, def_id, cdata,
163163
extern_crate => { Rc::new(cdata.extern_crate.get()) }
164164
is_no_builtins => { cdata.is_no_builtins(&tcx.dep_graph) }
165165
impl_defaultness => { cdata.get_impl_defaultness(def_id.index) }
166+
exported_symbols => { Rc::new(cdata.get_exported_symbols(&tcx.dep_graph)) }
166167
}
167168

168169
pub fn provide_local<'tcx>(providers: &mut Providers<'tcx>) {
@@ -302,11 +303,6 @@ impl CrateStore for cstore::CStore {
302303
self.get_crate_data(cnum).get_native_libraries(&self.dep_graph)
303304
}
304305

305-
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId>
306-
{
307-
self.get_crate_data(cnum).get_exported_symbols(&self.dep_graph)
308-
}
309-
310306
/// Returns the `DefKey` for a given `DefId`. This indicates the
311307
/// parent `DefId` as well as some idea of what kind of data the
312308
/// `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)