Skip to content

Commit bc0eabd

Browse files
committed
Remove some unused methods from metadata
Address comments + Fix rebase
1 parent bd291ce commit bc0eabd

File tree

6 files changed

+14
-26
lines changed

6 files changed

+14
-26
lines changed

src/librustc/middle/cstore.rs

-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ pub trait CrateStore<'tcx> {
201201
-> Option<DefIndex>;
202202
fn def_key(&self, def: DefId) -> hir_map::DefKey;
203203
fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath>;
204-
fn struct_ctor_def_id(&self, struct_def_id: DefId) -> Option<DefId>;
205204
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>;
206205
fn item_children(&self, did: DefId) -> Vec<def::Export>;
207206

@@ -377,8 +376,6 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
377376
fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath> {
378377
bug!("relative_def_path")
379378
}
380-
fn struct_ctor_def_id(&self, struct_def_id: DefId) -> Option<DefId>
381-
{ bug!("struct_ctor_def_id") }
382379
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name> { bug!("struct_field_names") }
383380
fn item_children(&self, did: DefId) -> Vec<def::Export> { bug!("item_children") }
384381

src/librustc_metadata/csearch.rs

-6
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,6 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
342342
self.get_crate_data(def.krate).def_path(def.index)
343343
}
344344

345-
fn struct_ctor_def_id(&self, struct_def_id: DefId) -> Option<DefId>
346-
{
347-
self.dep_graph.read(DepNode::MetaData(struct_def_id));
348-
self.get_crate_data(struct_def_id.krate).get_struct_ctor_def_id(struct_def_id.index)
349-
}
350-
351345
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>
352346
{
353347
self.dep_graph.read(DepNode::MetaData(def));

src/librustc_mir/transform/deaggregator.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use rustc::ty::TyCtxt;
12-
use rustc::hir::def::CtorKind;
1312
use rustc::mir::repr::*;
1413
use rustc::mir::transform::{MirPass, MirSource, Pass};
1514
use rustc_data_structures::indexed_vec::Idx;
@@ -129,10 +128,7 @@ fn get_aggregate_statement_index<'a, 'tcx, 'b>(start: usize,
129128
}
130129
debug!("getting variant {:?}", variant);
131130
debug!("for adt_def {:?}", adt_def);
132-
let variant_def = &adt_def.variants[variant];
133-
if variant_def.ctor_kind == CtorKind::Fictive {
134-
return Some(i);
135-
}
131+
return Some(i);
136132
};
137133
None
138134
}

src/librustc_resolve/build_reduced_graph.rs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use std::rc::Rc;
3131

3232
use syntax::ast::Name;
3333
use syntax::attr;
34+
use syntax::parse::token;
3435

3536
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind};
3637
use syntax::ast::{Mutability, StmtKind, TraitItem, TraitItemKind};

src/librustc_typeck/check/method/suggest.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -451,27 +451,26 @@ pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> {
451451
fn handle_external_def(ccx: &CrateCtxt,
452452
traits: &mut AllTraitsVec,
453453
external_mods: &mut FnvHashSet<DefId>,
454-
def_id: DefId) {
455-
match ccx.tcx.sess.cstore.describe_def(def_id) {
456-
Some(Def::Trait(_)) => {
454+
def: Def) {
455+
let def_id = def.def_id();
456+
match def {
457+
Def::Trait(..) => {
457458
traits.push(TraitInfo::new(def_id));
458459
}
459-
Some(Def::Mod(_)) => {
460+
Def::Mod(..) => {
460461
if !external_mods.insert(def_id) {
461462
return;
462463
}
463464
for child in ccx.tcx.sess.cstore.item_children(def_id) {
464-
handle_external_def(ccx, traits, external_mods, child.def.def_id())
465+
handle_external_def(ccx, traits, external_mods, child.def)
465466
}
466467
}
467468
_ => {}
468469
}
469470
}
470471
for cnum in ccx.tcx.sess.cstore.crates() {
471-
handle_external_def(ccx, &mut traits, &mut external_mods, DefId {
472-
krate: cnum,
473-
index: CRATE_DEF_INDEX
474-
});
472+
let def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
473+
handle_external_def(ccx, &mut traits, &mut external_mods, Def::Mod(def_id));
475474
}
476475

477476
*ccx.all_traits.borrow_mut() = Some(traits);

src/librustdoc/visit_lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> {
6666

6767
pub fn visit_mod(&mut self, def_id: DefId) {
6868
for item in self.cstore.item_children(def_id) {
69-
self.visit_item(item.def.def_id());
69+
self.visit_item(item.def);
7070
}
7171
}
7272

73-
fn visit_item(&mut self, def_id: DefId) {
73+
fn visit_item(&mut self, def: Def) {
74+
let def_id = def.def_id();
7475
let vis = self.cstore.visibility(def_id);
7576
let inherited_item_level = if vis == Visibility::Public {
7677
self.prev_level
@@ -80,7 +81,7 @@ impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> {
8081

8182
let item_level = self.update(def_id, inherited_item_level);
8283

83-
if let Some(Def::Mod(_)) = self.cstore.describe_def(def_id) {
84+
if let Def::Mod(..) = def {
8485
let orig_level = self.prev_level;
8586

8687
self.prev_level = item_level;

0 commit comments

Comments
 (0)