Skip to content

Commit

Permalink
Remove now unnecessary code
Browse files Browse the repository at this point in the history
This code was introduced in rust-lang#27565 to mark types in paths alive. It is now unnecessary since rust-lang#37676.
  • Loading branch information
sanxiyn committed Dec 15, 2016
1 parent 7ad7232 commit a759098
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
}
}

fn handle_definition(&mut self, id: ast::NodeId, def: Def) {
// If `bar` is a trait item, make sure to mark Foo as alive in `Foo::bar`
match def {
Def::AssociatedTy(..) | Def::Method(_) | Def::AssociatedConst(_)
if self.tcx.trait_of_item(def.def_id()).is_some() => {
if let Some(substs) = self.tcx.tables().item_substs.get(&id) {
if let ty::TyAdt(tyid, _) = substs.substs.type_at(0).sty {
self.check_def_id(tyid.did);
}
}
}
_ => {}
}

fn handle_definition(&mut self, def: Def) {
match def {
Def::Const(_) | Def::AssociatedConst(..) => {
self.check_def_id(def.def_id());
Expand Down Expand Up @@ -241,7 +228,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
match expr.node {
hir::ExprPath(ref qpath @ hir::QPath::TypeRelative(..)) => {
let def = self.tcx.tables().qpath_def(qpath, expr.id);
self.handle_definition(expr.id, def);
self.handle_definition(def);
}
hir::ExprMethodCall(..) => {
self.lookup_and_handle_method(expr.id);
Expand Down Expand Up @@ -281,7 +268,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
}
PatKind::Path(ref qpath @ hir::QPath::TypeRelative(..)) => {
let def = self.tcx.tables().qpath_def(qpath, pat.id);
self.handle_definition(pat.id, def);
self.handle_definition(def);
}
_ => ()
}
Expand All @@ -291,8 +278,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
self.ignore_non_const_paths = false;
}

fn visit_path(&mut self, path: &'tcx hir::Path, id: ast::NodeId) {
self.handle_definition(id, path.def);
fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) {
self.handle_definition(path.def);
intravisit::walk_path(self, path);
}
}
Expand Down

0 comments on commit a759098

Please sign in to comment.