mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Use 128 bit instead of Symbol for crate disambiguator
This commit is contained in:
parent
4c053db233
commit
d017466d10
@ -11,6 +11,7 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use dep_graph::{DepGraph, DepKind, DepNodeIndex};
|
use dep_graph::{DepGraph, DepKind, DepNodeIndex};
|
||||||
|
use ich::Fingerprint;
|
||||||
use hir::intravisit::{Visitor, NestedVisitorMap};
|
use hir::intravisit::{Visitor, NestedVisitorMap};
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use syntax::ast::{NodeId, CRATE_NODE_ID};
|
use syntax::ast::{NodeId, CRATE_NODE_ID};
|
||||||
@ -118,7 +119,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn finalize_and_compute_crate_hash(self,
|
pub(super) fn finalize_and_compute_crate_hash(self,
|
||||||
crate_disambiguator: &str)
|
crate_disambiguator: &Fingerprint)
|
||||||
-> Vec<MapEntry<'hir>> {
|
-> Vec<MapEntry<'hir>> {
|
||||||
let mut node_hashes: Vec<_> = self
|
let mut node_hashes: Vec<_> = self
|
||||||
.hir_body_nodes
|
.hir_body_nodes
|
||||||
|
@ -1014,7 +1014,7 @@ pub fn map_crate<'hir>(sess: &::session::Session,
|
|||||||
hcx);
|
hcx);
|
||||||
intravisit::walk_crate(&mut collector, &forest.krate);
|
intravisit::walk_crate(&mut collector, &forest.krate);
|
||||||
|
|
||||||
let crate_disambiguator = sess.local_crate_disambiguator().as_str();
|
let crate_disambiguator = sess.local_crate_disambiguator();
|
||||||
collector.finalize_and_compute_crate_hash(&crate_disambiguator)
|
collector.finalize_and_compute_crate_hash(&crate_disambiguator)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ pub trait CrateStore {
|
|||||||
fn export_macros_untracked(&self, cnum: CrateNum);
|
fn export_macros_untracked(&self, cnum: CrateNum);
|
||||||
fn dep_kind_untracked(&self, cnum: CrateNum) -> DepKind;
|
fn dep_kind_untracked(&self, cnum: CrateNum) -> DepKind;
|
||||||
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol;
|
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol;
|
||||||
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> Symbol;
|
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> ich::Fingerprint;
|
||||||
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
|
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
|
||||||
fn struct_field_names_untracked(&self, def: DefId) -> Vec<ast::Name>;
|
fn struct_field_names_untracked(&self, def: DefId) -> Vec<ast::Name>;
|
||||||
fn item_children_untracked(&self, did: DefId, sess: &Session) -> Vec<def::Export>;
|
fn item_children_untracked(&self, did: DefId, sess: &Session) -> Vec<def::Export>;
|
||||||
@ -338,7 +338,7 @@ impl CrateStore for DummyCrateStore {
|
|||||||
fn dep_kind_untracked(&self, cnum: CrateNum) -> DepKind { bug!("is_explicitly_linked") }
|
fn dep_kind_untracked(&self, cnum: CrateNum) -> DepKind { bug!("is_explicitly_linked") }
|
||||||
fn export_macros_untracked(&self, cnum: CrateNum) { bug!("export_macros") }
|
fn export_macros_untracked(&self, cnum: CrateNum) { bug!("export_macros") }
|
||||||
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol { bug!("crate_name") }
|
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol { bug!("crate_name") }
|
||||||
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> Symbol {
|
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> ich::Fingerprint {
|
||||||
bug!("crate_disambiguator")
|
bug!("crate_disambiguator")
|
||||||
}
|
}
|
||||||
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh { bug!("crate_hash") }
|
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh { bug!("crate_hash") }
|
||||||
|
@ -12,6 +12,7 @@ pub use self::code_stats::{CodeStats, DataTypeKind, FieldInfo};
|
|||||||
pub use self::code_stats::{SizeKind, TypeSizeInfo, VariantInfo};
|
pub use self::code_stats::{SizeKind, TypeSizeInfo, VariantInfo};
|
||||||
|
|
||||||
use hir::def_id::{CrateNum, DefIndex};
|
use hir::def_id::{CrateNum, DefIndex};
|
||||||
|
use ich::Fingerprint;
|
||||||
|
|
||||||
use lint;
|
use lint;
|
||||||
use middle::allocator::AllocatorKind;
|
use middle::allocator::AllocatorKind;
|
||||||
@ -29,7 +30,6 @@ use syntax::json::JsonEmitter;
|
|||||||
use syntax::feature_gate;
|
use syntax::feature_gate;
|
||||||
use syntax::parse;
|
use syntax::parse;
|
||||||
use syntax::parse::ParseSess;
|
use syntax::parse::ParseSess;
|
||||||
use syntax::symbol::Symbol;
|
|
||||||
use syntax::{ast, codemap};
|
use syntax::{ast, codemap};
|
||||||
use syntax::feature_gate::AttributeType;
|
use syntax::feature_gate::AttributeType;
|
||||||
use syntax_pos::{Span, MultiSpan};
|
use syntax_pos::{Span, MultiSpan};
|
||||||
@ -88,7 +88,7 @@ pub struct Session {
|
|||||||
/// forms a unique global identifier for the crate. It is used to allow
|
/// forms a unique global identifier for the crate. It is used to allow
|
||||||
/// multiple crates with the same name to coexist. See the
|
/// multiple crates with the same name to coexist. See the
|
||||||
/// trans::back::symbol_names module for more information.
|
/// trans::back::symbol_names module for more information.
|
||||||
pub crate_disambiguator: RefCell<Option<Symbol>>,
|
pub crate_disambiguator: RefCell<Option<Fingerprint>>,
|
||||||
pub features: RefCell<feature_gate::Features>,
|
pub features: RefCell<feature_gate::Features>,
|
||||||
|
|
||||||
/// The maximum recursion limit for potentially infinitely recursive
|
/// The maximum recursion limit for potentially infinitely recursive
|
||||||
@ -165,7 +165,7 @@ enum DiagnosticBuilderMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Session {
|
impl Session {
|
||||||
pub fn local_crate_disambiguator(&self) -> Symbol {
|
pub fn local_crate_disambiguator(&self) -> Fingerprint {
|
||||||
match *self.crate_disambiguator.borrow() {
|
match *self.crate_disambiguator.borrow() {
|
||||||
Some(sym) => sym,
|
Some(sym) => sym,
|
||||||
None => bug!("accessing disambiguator before initialization"),
|
None => bug!("accessing disambiguator before initialization"),
|
||||||
@ -471,14 +471,17 @@ impl Session {
|
|||||||
|
|
||||||
/// Returns the symbol name for the registrar function,
|
/// Returns the symbol name for the registrar function,
|
||||||
/// given the crate Svh and the function DefIndex.
|
/// given the crate Svh and the function DefIndex.
|
||||||
pub fn generate_plugin_registrar_symbol(&self, disambiguator: Symbol, index: DefIndex)
|
pub fn generate_plugin_registrar_symbol(&self, disambiguator: Fingerprint,
|
||||||
|
index: DefIndex)
|
||||||
-> String {
|
-> String {
|
||||||
format!("__rustc_plugin_registrar__{}_{}", disambiguator, index.as_usize())
|
format!("__rustc_plugin_registrar__{}_{}", disambiguator.to_hex(),
|
||||||
|
index.as_usize())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_derive_registrar_symbol(&self, disambiguator: Symbol, index: DefIndex)
|
pub fn generate_derive_registrar_symbol(&self, disambiguator: Fingerprint, index: DefIndex)
|
||||||
-> String {
|
-> String {
|
||||||
format!("__rustc_derive_registrar__{}_{}", disambiguator, index.as_usize())
|
format!("__rustc_derive_registrar__{}_{}", disambiguator.to_hex(),
|
||||||
|
index.as_usize())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sysroot<'a>(&'a self) -> &'a Path {
|
pub fn sysroot<'a>(&'a self) -> &'a Path {
|
||||||
|
@ -1251,7 +1251,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||||||
crate_name,
|
crate_name,
|
||||||
// Don't print the whole crate disambiguator. That's just
|
// Don't print the whole crate disambiguator. That's just
|
||||||
// annoying in debug output.
|
// annoying in debug output.
|
||||||
&(crate_disambiguator.as_str())[..4],
|
&(crate_disambiguator.to_hex())[..4],
|
||||||
self.def_path(def_id).to_string_no_crate())
|
self.def_path(def_id).to_string_no_crate())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
use dep_graph::{DepConstructor, DepNode};
|
use dep_graph::{DepConstructor, DepNode};
|
||||||
use errors::DiagnosticBuilder;
|
use errors::DiagnosticBuilder;
|
||||||
|
use ich::Fingerprint;
|
||||||
use hir::def_id::{CrateNum, DefId, DefIndex};
|
use hir::def_id::{CrateNum, DefId, DefIndex};
|
||||||
use hir::def::{Def, Export};
|
use hir::def::{Def, Export};
|
||||||
use hir::{self, TraitCandidate, ItemLocalId};
|
use hir::{self, TraitCandidate, ItemLocalId};
|
||||||
@ -283,7 +284,7 @@ define_maps! { <'tcx>
|
|||||||
[] fn native_libraries: NativeLibraries(CrateNum) -> Rc<Vec<NativeLibrary>>,
|
[] fn native_libraries: NativeLibraries(CrateNum) -> Rc<Vec<NativeLibrary>>,
|
||||||
[] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
|
[] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
|
||||||
[] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
|
[] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
|
||||||
[] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> Symbol,
|
[] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> Fingerprint,
|
||||||
[] fn crate_hash: CrateHash(CrateNum) -> Svh,
|
[] fn crate_hash: CrateHash(CrateNum) -> Svh,
|
||||||
[] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
|
[] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ use hir::{map as hir_map, FreevarMap, TraitMap};
|
|||||||
use hir::def::{Def, CtorKind, ExportMap};
|
use hir::def::{Def, CtorKind, ExportMap};
|
||||||
use hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
|
use hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||||
use hir::map::DefPathData;
|
use hir::map::DefPathData;
|
||||||
use ich::StableHashingContext;
|
use ich::{Fingerprint, StableHashingContext};
|
||||||
use middle::const_val::ConstVal;
|
use middle::const_val::ConstVal;
|
||||||
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem};
|
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem};
|
||||||
use middle::privacy::AccessLevels;
|
use middle::privacy::AccessLevels;
|
||||||
@ -2562,7 +2562,7 @@ fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn crate_disambiguator<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn crate_disambiguator<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
crate_num: CrateNum) -> Symbol {
|
crate_num: CrateNum) -> Fingerprint {
|
||||||
assert_eq!(crate_num, LOCAL_CRATE);
|
assert_eq!(crate_num, LOCAL_CRATE);
|
||||||
tcx.sess.local_crate_disambiguator()
|
tcx.sess.local_crate_disambiguator()
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,6 @@ use syntax::{ast, diagnostics, visit};
|
|||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::ext::base::ExtCtxt;
|
use syntax::ext::base::ExtCtxt;
|
||||||
use syntax::parse::{self, PResult};
|
use syntax::parse::{self, PResult};
|
||||||
use syntax::symbol::Symbol;
|
|
||||||
use syntax::util::node_count::NodeCounter;
|
use syntax::util::node_count::NodeCounter;
|
||||||
use syntax;
|
use syntax;
|
||||||
use syntax_ext;
|
use syntax_ext;
|
||||||
@ -633,12 +632,12 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
|
|||||||
|
|
||||||
*sess.crate_types.borrow_mut() = collect_crate_types(sess, &krate.attrs);
|
*sess.crate_types.borrow_mut() = collect_crate_types(sess, &krate.attrs);
|
||||||
|
|
||||||
let disambiguator = Symbol::intern(&compute_crate_disambiguator(sess));
|
let disambiguator = compute_crate_disambiguator(sess);
|
||||||
*sess.crate_disambiguator.borrow_mut() = Some(disambiguator);
|
*sess.crate_disambiguator.borrow_mut() = Some(disambiguator);
|
||||||
rustc_incremental::prepare_session_directory(
|
rustc_incremental::prepare_session_directory(
|
||||||
sess,
|
sess,
|
||||||
&crate_name,
|
&crate_name,
|
||||||
&disambiguator.as_str(),
|
&disambiguator,
|
||||||
);
|
);
|
||||||
|
|
||||||
let dep_graph = if sess.opts.build_dep_graph() {
|
let dep_graph = if sess.opts.build_dep_graph() {
|
||||||
@ -1312,16 +1311,13 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec<c
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_crate_disambiguator(session: &Session) -> String {
|
pub fn compute_crate_disambiguator(session: &Session) -> Fingerprint {
|
||||||
use std::hash::Hasher;
|
use std::hash::Hasher;
|
||||||
|
|
||||||
// The crate_disambiguator is a 128 bit hash. The disambiguator is fed
|
// The crate_disambiguator is a 128 bit hash. The disambiguator is fed
|
||||||
// into various other hashes quite a bit (symbol hashes, incr. comp. hashes,
|
// into various other hashes quite a bit (symbol hashes, incr. comp. hashes,
|
||||||
// debuginfo type IDs, etc), so we don't want it to be too wide. 128 bits
|
// debuginfo type IDs, etc), so we don't want it to be too wide. 128 bits
|
||||||
// should still be safe enough to avoid collisions in practice.
|
// should still be safe enough to avoid collisions in practice.
|
||||||
// FIXME(mw): It seems that the crate_disambiguator is used everywhere as
|
|
||||||
// a hex-string instead of raw bytes. We should really use the
|
|
||||||
// smaller representation.
|
|
||||||
let mut hasher = StableHasher::<Fingerprint>::new();
|
let mut hasher = StableHasher::<Fingerprint>::new();
|
||||||
|
|
||||||
let mut metadata = session.opts.cg.metadata.clone();
|
let mut metadata = session.opts.cg.metadata.clone();
|
||||||
@ -1340,11 +1336,13 @@ pub fn compute_crate_disambiguator(session: &Session) -> String {
|
|||||||
hasher.write(s.as_bytes());
|
hasher.write(s.as_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is an executable, add a special suffix, so that we don't get
|
// Also incorporate crate type, so that we don't get symbol conflicts when
|
||||||
// symbol conflicts when linking against a library of the same name.
|
// linking against a library of the same name, if this is an executable.
|
||||||
let is_exe = session.crate_types.borrow().contains(&config::CrateTypeExecutable);
|
let is_exe = session.crate_types.borrow().contains(&config::CrateTypeExecutable);
|
||||||
|
hasher.write(if is_exe { b"exe" } else { b"lib" });
|
||||||
|
|
||||||
|
hasher.finish()
|
||||||
|
|
||||||
format!("{}{}", hasher.finish().to_hex(), if is_exe { "-exe" } else {""})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_output_filenames(input: &Input,
|
pub fn build_output_filenames(input: &Input,
|
||||||
|
@ -114,6 +114,7 @@
|
|||||||
//! unsupported file system and emit a warning in that case. This is not yet
|
//! unsupported file system and emit a warning in that case. This is not yet
|
||||||
//! implemented.
|
//! implemented.
|
||||||
|
|
||||||
|
use rustc::ich::Fingerprint;
|
||||||
use rustc::hir::svh::Svh;
|
use rustc::hir::svh::Svh;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::util::fs as fs_util;
|
use rustc::util::fs as fs_util;
|
||||||
@ -188,7 +189,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu
|
|||||||
/// The garbage collection will take care of it.
|
/// The garbage collection will take care of it.
|
||||||
pub fn prepare_session_directory(sess: &Session,
|
pub fn prepare_session_directory(sess: &Session,
|
||||||
crate_name: &str,
|
crate_name: &str,
|
||||||
crate_disambiguator: &str) {
|
crate_disambiguator: &Fingerprint) {
|
||||||
if sess.opts.incremental.is_none() {
|
if sess.opts.incremental.is_none() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -614,21 +615,15 @@ fn string_to_timestamp(s: &str) -> Result<SystemTime, ()> {
|
|||||||
|
|
||||||
fn crate_path(sess: &Session,
|
fn crate_path(sess: &Session,
|
||||||
crate_name: &str,
|
crate_name: &str,
|
||||||
crate_disambiguator: &str)
|
crate_disambiguator: &Fingerprint)
|
||||||
-> PathBuf {
|
-> PathBuf {
|
||||||
use std::hash::{Hasher, Hash};
|
|
||||||
use std::collections::hash_map::DefaultHasher;
|
|
||||||
|
|
||||||
let incr_dir = sess.opts.incremental.as_ref().unwrap().clone();
|
let incr_dir = sess.opts.incremental.as_ref().unwrap().clone();
|
||||||
|
|
||||||
// The full crate disambiguator is really long. A hash of it should be
|
let crate_disambiguator = crate_disambiguator.to_smaller_hash();
|
||||||
// sufficient.
|
|
||||||
let mut hasher = DefaultHasher::new();
|
|
||||||
crate_disambiguator.hash(&mut hasher);
|
|
||||||
|
|
||||||
let crate_name = format!("{}-{}",
|
let crate_name = format!("{}-{}",
|
||||||
crate_name,
|
crate_name,
|
||||||
base_n::encode(hasher.finish(), INT_ENCODE_BASE));
|
base_n::encode(crate_disambiguator, INT_ENCODE_BASE));
|
||||||
incr_dir.join(crate_name)
|
incr_dir.join(crate_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ use locator::{self, CratePaths};
|
|||||||
use native_libs::relevant_lib;
|
use native_libs::relevant_lib;
|
||||||
use schema::CrateRoot;
|
use schema::CrateRoot;
|
||||||
|
|
||||||
|
use rustc::ich::Fingerprint;
|
||||||
use rustc::hir::def_id::{CrateNum, DefIndex, CRATE_DEF_INDEX};
|
use rustc::hir::def_id::{CrateNum, DefIndex, CRATE_DEF_INDEX};
|
||||||
use rustc::hir::svh::Svh;
|
use rustc::hir::svh::Svh;
|
||||||
use rustc::middle::allocator::AllocatorKind;
|
use rustc::middle::allocator::AllocatorKind;
|
||||||
@ -626,7 +627,7 @@ impl<'a> CrateLoader<'a> {
|
|||||||
pub fn find_plugin_registrar(&mut self,
|
pub fn find_plugin_registrar(&mut self,
|
||||||
span: Span,
|
span: Span,
|
||||||
name: &str)
|
name: &str)
|
||||||
-> Option<(PathBuf, Symbol, DefIndex)> {
|
-> Option<(PathBuf, Fingerprint, DefIndex)> {
|
||||||
let ekrate = self.read_extension_crate(span, &ExternCrateInfo {
|
let ekrate = self.read_extension_crate(span, &ExternCrateInfo {
|
||||||
name: Symbol::intern(name),
|
name: Symbol::intern(name),
|
||||||
ident: Symbol::intern(name),
|
ident: Symbol::intern(name),
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
use schema;
|
use schema;
|
||||||
|
|
||||||
|
use rustc::ich::Fingerprint;
|
||||||
use rustc::hir::def_id::{CRATE_DEF_INDEX, CrateNum, DefIndex};
|
use rustc::hir::def_id::{CRATE_DEF_INDEX, CrateNum, DefIndex};
|
||||||
use rustc::hir::map::definitions::DefPathTable;
|
use rustc::hir::map::definitions::DefPathTable;
|
||||||
use rustc::hir::svh::Svh;
|
use rustc::hir::svh::Svh;
|
||||||
@ -171,7 +172,7 @@ impl CrateMetadata {
|
|||||||
pub fn hash(&self) -> Svh {
|
pub fn hash(&self) -> Svh {
|
||||||
self.root.hash
|
self.root.hash
|
||||||
}
|
}
|
||||||
pub fn disambiguator(&self) -> Symbol {
|
pub fn disambiguator(&self) -> Fingerprint {
|
||||||
self.root.disambiguator
|
self.root.disambiguator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ use rustc::middle::cstore::{CrateStore, DepKind,
|
|||||||
LoadedMacro, EncodedMetadata,
|
LoadedMacro, EncodedMetadata,
|
||||||
EncodedMetadataHashes, NativeLibraryKind};
|
EncodedMetadataHashes, NativeLibraryKind};
|
||||||
use rustc::middle::stability::DeprecationEntry;
|
use rustc::middle::stability::DeprecationEntry;
|
||||||
|
use rustc::ich::Fingerprint;
|
||||||
use rustc::hir::def;
|
use rustc::hir::def;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::ty::{self, TyCtxt};
|
use rustc::ty::{self, TyCtxt};
|
||||||
@ -384,7 +385,7 @@ impl CrateStore for cstore::CStore {
|
|||||||
self.get_crate_data(cnum).name
|
self.get_crate_data(cnum).name
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> Symbol
|
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> Fingerprint
|
||||||
{
|
{
|
||||||
self.get_crate_data(cnum).disambiguator()
|
self.get_crate_data(cnum).disambiguator()
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use index;
|
|||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def::{self, CtorKind};
|
use rustc::hir::def::{self, CtorKind};
|
||||||
use rustc::hir::def_id::{DefIndex, DefId, CrateNum};
|
use rustc::hir::def_id::{DefIndex, DefId, CrateNum};
|
||||||
use rustc::ich::StableHashingContext;
|
use rustc::ich::{Fingerprint, StableHashingContext};
|
||||||
use rustc::middle::cstore::{DepKind, LinkagePreference, NativeLibrary};
|
use rustc::middle::cstore::{DepKind, LinkagePreference, NativeLibrary};
|
||||||
use rustc::middle::lang_items;
|
use rustc::middle::lang_items;
|
||||||
use rustc::mir;
|
use rustc::mir;
|
||||||
@ -191,7 +191,7 @@ pub struct CrateRoot {
|
|||||||
pub name: Symbol,
|
pub name: Symbol,
|
||||||
pub triple: String,
|
pub triple: String,
|
||||||
pub hash: hir::svh::Svh,
|
pub hash: hir::svh::Svh,
|
||||||
pub disambiguator: Symbol,
|
pub disambiguator: Fingerprint,
|
||||||
pub panic_strategy: PanicStrategy,
|
pub panic_strategy: PanicStrategy,
|
||||||
pub has_global_allocator: bool,
|
pub has_global_allocator: bool,
|
||||||
pub has_default_lib_allocator: bool,
|
pub has_default_lib_allocator: bool,
|
||||||
|
@ -1417,7 +1417,7 @@ impl<'a> Resolver<'a> {
|
|||||||
|
|
||||||
let mut definitions = Definitions::new();
|
let mut definitions = Definitions::new();
|
||||||
DefCollector::new(&mut definitions, Mark::root())
|
DefCollector::new(&mut definitions, Mark::root())
|
||||||
.collect_root(crate_name, &session.local_crate_disambiguator().as_str());
|
.collect_root(crate_name, &session.local_crate_disambiguator().to_hex());
|
||||||
|
|
||||||
let mut invocations = FxHashMap();
|
let mut invocations = FxHashMap();
|
||||||
invocations.insert(Mark::root(),
|
invocations.insert(Mark::root(),
|
||||||
|
@ -34,7 +34,7 @@ pub fn threshold(tcx: TyCtxt) -> SymbolExportLevel {
|
|||||||
pub fn metadata_symbol_name(tcx: TyCtxt) -> String {
|
pub fn metadata_symbol_name(tcx: TyCtxt) -> String {
|
||||||
format!("rust_metadata_{}_{}",
|
format!("rust_metadata_{}_{}",
|
||||||
tcx.crate_name(LOCAL_CRATE),
|
tcx.crate_name(LOCAL_CRATE),
|
||||||
tcx.crate_disambiguator(LOCAL_CRATE))
|
tcx.crate_disambiguator(LOCAL_CRATE).to_hex())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crate_export_threshold(crate_type: config::CrateType) -> SymbolExportLevel {
|
fn crate_export_threshold(crate_type: config::CrateType) -> SymbolExportLevel {
|
||||||
|
@ -220,7 +220,7 @@ fn get_symbol_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||||||
|
|
||||||
if avoid_cross_crate_conflicts {
|
if avoid_cross_crate_conflicts {
|
||||||
hasher.hash(tcx.crate_name.as_str());
|
hasher.hash(tcx.crate_name.as_str());
|
||||||
hasher.hash(tcx.sess.local_crate_disambiguator().as_str());
|
hasher.hash(tcx.sess.local_crate_disambiguator());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user