use crate::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
use crate::hir::HirId;
-use syntax::symbol::InternedString;
+use syntax::symbol::Symbol;
use syntax::attr::InlineAttr;
use syntax::source_map::Span;
use crate::ty::{Instance, InstanceDef, TyCtxt, SymbolName, subst::InternalSubsts};
use crate::ty::print::obsolete::DefPathBasedNames;
use crate::dep_graph::{WorkProductId, DepNode, WorkProduct, DepConstructor};
use rustc_data_structures::base_n;
-use rustc_data_structures::stable_hasher::{HashStable, StableHasherResult,
- StableHasher};
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use crate::ich::{Fingerprint, StableHashingContext, NodeIdHashingMode};
use crate::session::config::OptLevel;
use std::fmt;
use std::hash::Hash;
/// Describes how a monomorphization will be instantiated in object files.
-#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)]
+#[derive(PartialEq)]
pub enum InstantiationMode {
/// There will be exactly one instance of the given MonoItem. It will have
/// external linkage so that it can be linked to from other codegen units.
MonoItem::GlobalAsm(hir_id) => {
let def_id = tcx.hir().local_def_id(hir_id);
SymbolName {
- name: InternedString::intern(&format!("global_asm_{:?}", def_id))
+ name: Symbol::intern(&format!("global_asm_{:?}", def_id))
}
}
}
}
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx> {
- fn hash_stable<W: StableHasherResult>(&self,
- hcx: &mut StableHashingContext<'a>,
- hasher: &mut StableHasher<W>) {
+ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
::std::mem::discriminant(self).hash_stable(hcx, hasher);
match *self {
/// name be unique amongst **all** crates. Therefore, it should
/// contain something unique to this crate (e.g., a module path)
/// as well as the crate name and disambiguator.
- name: InternedString,
+ name: Symbol,
items: FxHashMap<MonoItem<'tcx>, (Linkage, Visibility)>,
size_estimate: Option<usize>,
}
-#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
pub enum Linkage {
External,
AvailableExternally,
Common
});
-#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
+#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Visibility {
Default,
Hidden,
});
impl<'tcx> CodegenUnit<'tcx> {
- pub fn new(name: InternedString) -> CodegenUnit<'tcx> {
+ pub fn new(name: Symbol) -> CodegenUnit<'tcx> {
CodegenUnit {
name: name,
items: Default::default(),
}
}
- pub fn name(&self) -> &InternedString {
- &self.name
+ pub fn name(&self) -> Symbol {
+ self.name
}
- pub fn set_name(&mut self, name: InternedString) {
+ pub fn set_name(&mut self, name: Symbol) {
self.name = name;
}
tcx.hir().as_local_hir_id(def_id)
}
InstanceDef::VtableShim(..) |
+ InstanceDef::ReifyShim(..) |
InstanceDef::Intrinsic(..) |
InstanceDef::FnPtrShim(..) |
InstanceDef::Virtual(..) |
}
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for CodegenUnit<'tcx> {
- fn hash_stable<W: StableHasherResult>(&self,
- hcx: &mut StableHashingContext<'a>,
- hasher: &mut StableHasher<W>) {
+ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
let CodegenUnit {
ref items,
name,
cnum: CrateNum,
components: I,
special_suffix: Option<S>)
- -> InternedString
+ -> Symbol
where I: IntoIterator<Item=C>,
C: fmt::Display,
S: fmt::Display,
cgu_name
} else {
let cgu_name = &cgu_name.as_str()[..];
- InternedString::intern(&CodegenUnit::mangle_name(cgu_name))
+ Symbol::intern(&CodegenUnit::mangle_name(cgu_name))
}
}
cnum: CrateNum,
components: I,
special_suffix: Option<S>)
- -> InternedString
+ -> Symbol
where I: IntoIterator<Item=C>,
C: fmt::Display,
S: fmt::Display,
write!(cgu_name, ".{}", special_suffix).unwrap();
}
- InternedString::intern(&cgu_name[..])
+ Symbol::intern(&cgu_name[..])
}
}