metadata: Remove CrateMetadata::name
It duplicates `CrateRoot::name`
This commit is contained in:
parent
f13adc5f9d
commit
0f96ba92b6
4 changed files with 6 additions and 11 deletions
|
@ -112,7 +112,7 @@ impl<'a> CrateLoader<'a> {
|
|||
-> 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 @@ impl<'a> CrateLoader<'a> {
|
|||
});
|
||||
|
||||
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 @@ impl<'a> CrateLoader<'a> {
|
|||
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -12,7 +12,6 @@ use rustc::util::nodemap::{FxHashMap, NodeMap};
|
|||
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)
|
||||
|
|
|
@ -220,7 +220,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
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 @@ impl cstore::CStore {
|
|||
}
|
||||
|
||||
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 @@ impl CrateStore for cstore::CStore {
|
|||
|
||||
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 {
|
||||
|
|
|
@ -473,7 +473,7 @@ impl<'a, 'tcx> CrateMetadata {
|
|||
None => {
|
||||
bug!("entry: id not found: {:?} in crate {:?} with number {}",
|
||||
item_id,
|
||||
self.name,
|
||||
self.root.name,
|
||||
self.cnum)
|
||||
}
|
||||
Some(d) => d.decode(self),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue