[] ImplDefaultness(DefId),
[] ExportedSymbols(CrateNum),
[] NativeLibraries(CrateNum),
+ [] PluginRegistrarFn(CrateNum),
+ [] DeriveRegistrarFn(CrateNum),
);
trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {
fn original_crate_name(&self, cnum: CrateNum) -> Symbol;
fn crate_hash(&self, cnum: CrateNum) -> Svh;
fn crate_disambiguator(&self, cnum: CrateNum) -> Symbol;
- fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
- fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
// resolve
fn def_key(&self, def: DefId) -> DefKey;
fn crate_hash(&self, cnum: CrateNum) -> Svh { bug!("crate_hash") }
fn crate_disambiguator(&self, cnum: CrateNum)
-> Symbol { bug!("crate_disambiguator") }
- fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>
- { bug!("plugin_registrar_fn") }
- fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>
- { bug!("derive_registrar_fn") }
// resolve
fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") }
}
}
+impl<'tcx> QueryDescription for queries::plugin_registrar_fn<'tcx> {
+ fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ format!("looking up the plugin registrar for a crate")
+ }
+}
+
+impl<'tcx> QueryDescription for queries::derive_registrar_fn<'tcx> {
+ fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ format!("looking up the derive registrar for a crate")
+ }
+}
+
// If enabled, send a message to the profile-queries thread
macro_rules! profq_msg {
($tcx:expr, $msg:expr) => {
[] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
[] fn exported_symbols: ExportedSymbols(CrateNum) -> Rc<Vec<DefId>>,
[] fn native_libraries: NativeLibraries(CrateNum) -> Rc<Vec<NativeLibrary>>,
+ [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
+ [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
}
fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {
};
let prfn = match cx.sess().cstore.extern_mod_stmt_cnum(it.id) {
- Some(cnum) => cx.sess().cstore.plugin_registrar_fn(cnum),
+ Some(cnum) => cx.tcx.plugin_registrar_fn(cnum),
None => {
// Probably means we aren't linking the crate for some reason.
//
impl_defaultness => { cdata.get_impl_defaultness(def_id.index) }
exported_symbols => { Rc::new(cdata.get_exported_symbols(&tcx.dep_graph)) }
native_libraries => { Rc::new(cdata.get_native_libraries(&tcx.dep_graph)) }
+ plugin_registrar_fn => {
+ cdata.root.plugin_registrar_fn.map(|index| {
+ DefId { krate: def_id.krate, index }
+ })
+ }
+ derive_registrar_fn => {
+ cdata.root.macro_derive_registrar.map(|index| {
+ DefId { krate: def_id.krate, index }
+ })
+ }
}
pub fn provide_local<'tcx>(providers: &mut Providers<'tcx>) {
self.get_crate_data(cnum).disambiguator()
}
- fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>
- {
- self.get_crate_data(cnum).root.plugin_registrar_fn.map(|index| DefId {
- krate: cnum,
- index,
- })
- }
-
- fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>
- {
- self.get_crate_data(cnum).root.macro_derive_registrar.map(|index| DefId {
- krate: cnum,
- index,
- })
- }
-
/// Returns the `DefKey` for a given `DefId`. This indicates the
/// parent `DefId` as well as some idea of what kind of data the
/// `DefId` refers to.
// If this crate is a plugin and/or a custom derive crate, then
// we're not even going to link those in so we skip those crates.
- if tcx.sess.cstore.plugin_registrar_fn(cnum).is_some() ||
- tcx.sess.cstore.derive_registrar_fn(cnum).is_some() {
+ if tcx.plugin_registrar_fn(cnum).is_some() ||
+ tcx.derive_registrar_fn(cnum).is_some() {
continue;
}