Skip to content

Commit 0f96ba9

Browse files
committed
metadata: Remove CrateMetadata::name
It duplicates `CrateRoot::name`
1 parent f13adc5 commit 0f96ba9

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

src/librustc_metadata/creader.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a> CrateLoader<'a> {
112112
-> Option<CrateNum> {
113113
let mut ret = None;
114114
self.cstore.iter_crate_data(|cnum, data| {
115-
if data.name != name { return }
115+
if data.root.name != name { return }
116116

117117
match hash {
118118
Some(hash) if *hash == data.root.hash => { ret = Some(cnum); return }
@@ -252,7 +252,6 @@ impl<'a> CrateLoader<'a> {
252252
});
253253

254254
let cmeta = cstore::CrateMetadata {
255-
name: crate_root.name,
256255
extern_crate: Lock::new(None),
257256
def_path_table: Lrc::new(def_path_table),
258257
trait_impls,
@@ -789,7 +788,7 @@ impl<'a> CrateLoader<'a> {
789788

790789
let mut uses_std = false;
791790
self.cstore.iter_crate_data(|_, data| {
792-
if data.name == sym::std {
791+
if data.root.name == sym::std {
793792
uses_std = true;
794793
}
795794
});

src/librustc_metadata/cstore.rs

-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rustc::util::nodemap::{FxHashMap, NodeMap};
1212
use rustc_data_structures::sync::{Lrc, RwLock, Lock};
1313
use syntax::ast;
1414
use syntax::ext::base::SyntaxExtension;
15-
use syntax::symbol::Symbol;
1615
use syntax_pos;
1716

1817
pub use rustc::middle::cstore::{NativeLibrary, NativeLibraryKind, LinkagePreference};
@@ -45,9 +44,6 @@ pub struct ImportedSourceFile {
4544
}
4645

4746
pub struct CrateMetadata {
48-
/// Original name of the crate.
49-
pub name: Symbol,
50-
5147
/// Information about the extern crate that caused this crate to
5248
/// be loaded. If this is `None`, then the crate was injected
5349
/// (e.g., by the allocator)

src/librustc_metadata/cstore_impl.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
220220
let r = *cdata.dep_kind.lock();
221221
r
222222
}
223-
crate_name => { cdata.name }
223+
crate_name => { cdata.root.name }
224224
item_children => {
225225
let mut result = SmallVec::<[_; 8]>::new();
226226
cdata.each_child_of_item(def_id.index, |child| result.push(child), tcx.sess);
@@ -453,7 +453,7 @@ impl cstore::CStore {
453453
}
454454

455455
let def = data.get_macro(id.index);
456-
let macro_full_name = data.def_path(id.index).to_string_friendly(|_| data.name);
456+
let macro_full_name = data.def_path(id.index).to_string_friendly(|_| data.root.name);
457457
let source_name = FileName::Macros(macro_full_name);
458458

459459
let source_file = sess.parse_sess.source_map().new_source_file(source_name, def.body);
@@ -503,7 +503,7 @@ impl CrateStore for cstore::CStore {
503503

504504
fn crate_name_untracked(&self, cnum: CrateNum) -> Symbol
505505
{
506-
self.get_crate_data(cnum).name
506+
self.get_crate_data(cnum).root.name
507507
}
508508

509509
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool {

src/librustc_metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ impl<'a, 'tcx> CrateMetadata {
473473
None => {
474474
bug!("entry: id not found: {:?} in crate {:?} with number {}",
475475
item_id,
476-
self.name,
476+
self.root.name,
477477
self.cnum)
478478
}
479479
Some(d) => d.decode(self),

0 commit comments

Comments
 (0)