[] NativeLibraries(CrateNum),
[] PluginRegistrarFn(CrateNum),
[] DeriveRegistrarFn(CrateNum),
+ [] CrateDisambiguator(CrateNum),
);
trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {
/// The name of the crate as it is stored in the crate's metadata.
fn original_crate_name(&self, cnum: CrateNum) -> Symbol;
fn crate_hash(&self, cnum: CrateNum) -> Svh;
- fn crate_disambiguator(&self, cnum: CrateNum) -> Symbol;
// resolve
fn def_key(&self, def: DefId) -> DefKey;
bug!("original_crate_name")
}
fn crate_hash(&self, cnum: CrateNum) -> Svh { bug!("crate_hash") }
- fn crate_disambiguator(&self, cnum: CrateNum)
- -> Symbol { bug!("crate_disambiguator") }
// resolve
fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") }
}
}
- pub fn crate_disambiguator(self, cnum: CrateNum) -> Symbol {
- if cnum == LOCAL_CRATE {
- self.sess.local_crate_disambiguator()
- } else {
- self.sess.cstore.crate_disambiguator(cnum)
- }
- }
-
pub fn alloc_generics(self, generics: ty::Generics) -> &'gcx ty::Generics {
self.global_arenas.generics.alloc(generics)
}
}
}
+impl<'tcx> QueryDescription for queries::crate_disambiguator<'tcx> {
+ fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ format!("looking up the disambiguator a crate")
+ }
+}
+
// If enabled, send a message to the profile-queries thread
macro_rules! profq_msg {
($tcx:expr, $msg:expr) => {
[] 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 crate_disambiguator: CrateDisambiguator(CrateNum) -> Symbol,
}
fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {
traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause)
}
+fn crate_disambiguator<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+ crate_num: CrateNum) -> Symbol {
+ assert_eq!(crate_num, LOCAL_CRATE);
+ tcx.sess.local_crate_disambiguator()
+}
+
pub fn provide(providers: &mut ty::maps::Providers) {
util::provide(providers);
context::provide(providers);
def_span,
param_env,
trait_of_item,
+ crate_disambiguator,
trait_impls_of: trait_def::trait_impls_of_provider,
..*providers
};
DefId { krate: def_id.krate, index }
})
}
+ crate_disambiguator => { cdata.disambiguator() }
+ crate_hash => { cdata.hash() }
+ original_crate_name => { cdata.name() }
}
pub fn provide_local<'tcx>(providers: &mut Providers<'tcx>) {
self.get_crate_hash(cnum)
}
- fn crate_disambiguator(&self, cnum: CrateNum) -> Symbol
- {
- self.get_crate_data(cnum).disambiguator()
- }
-
/// 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.