metadata: Remove CrateMetadata::name

It duplicates `CrateRoot::name`
This commit is contained in:
Vadim Petrochenkov
2019-10-02 03:15:38 +03:00
parent f13adc5f9d
commit 0f96ba92b6
4 changed files with 6 additions and 11 deletions
+2 -3
View File
@@ -112,7 +112,7 @@ fn existing_match(&self, name: Symbol, hash: Option<&Svh>, kind: PathKind)
-> Option<CrateNum> {
let mut ret = None;
self.cstore.iter_crate_data(|cnum, data| {
if data.name != name { return }
if data.root.name != name { return }
match hash {
Some(hash) if *hash == data.root.hash => { ret = Some(cnum); return }
@@ -252,7 +252,6 @@ fn register_crate(
});
let cmeta = cstore::CrateMetadata {
name: crate_root.name,
extern_crate: Lock::new(None),
def_path_table: Lrc::new(def_path_table),
trait_impls,
@@ -789,7 +788,7 @@ fn inject_sanitizer_runtime(&mut self) {
let mut uses_std = false;
self.cstore.iter_crate_data(|_, data| {
if data.name == sym::std {
if data.root.name == sym::std {
uses_std = true;
}
});
-4
View File
@@ -12,7 +12,6 @@
use rustc_data_structures::sync::{Lrc, RwLock, Lock};
use syntax::ast;
use syntax::ext::base::SyntaxExtension;
use syntax::symbol::Symbol;
use syntax_pos;
pub use rustc::middle::cstore::{NativeLibrary, NativeLibraryKind, LinkagePreference};
@@ -45,9 +44,6 @@ pub struct ImportedSourceFile {
}
pub struct CrateMetadata {
/// Original name of the crate.
pub name: Symbol,
/// Information about the extern crate that caused this crate to
/// be loaded. If this is `None`, then the crate was injected
/// (e.g., by the allocator)
+3 -3
View File
@@ -220,7 +220,7 @@ fn into_args(self) -> (DefId, DefId) { (self.0.as_def_id(), self.1) }
let r = *cdata.dep_kind.lock();
r
}
crate_name => { cdata.name }
crate_name => { cdata.root.name }
item_children => {
let mut result = SmallVec::<[_; 8]>::new();
cdata.each_child_of_item(def_id.index, |child| result.push(child), tcx.sess);
@@ -453,7 +453,7 @@ pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro {
}
let def = data.get_macro(id.index);
let macro_full_name = data.def_path(id.index).to_string_friendly(|_| data.name);
let macro_full_name = data.def_path(id.index).to_string_friendly(|_| data.root.name);
let source_name = FileName::Macros(macro_full_name);
let source_file = sess.parse_sess.source_map().new_source_file(source_name, def.body);
@@ -503,7 +503,7 @@ fn item_generics_cloned_untracked(&self, def: DefId, sess: &Session) -> ty::Gene
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol
{
self.get_crate_data(cnum).name
self.get_crate_data(cnum).root.name
}
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool {
+1 -1
View File
@@ -473,7 +473,7 @@ fn entry(&self, item_id: DefIndex) -> Entry<'tcx> {
None => {
bug!("entry: id not found: {:?} in crate {:?} with number {}",
item_id,
self.name,
self.root.name,
self.cnum)
}
Some(d) => d.decode(self),