about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2016-11-28 23:30:48 +0900
committerSeo Sanghyeon <sanxiyn@gmail.com>2016-12-15 18:35:20 +0900
commita75909824ac703f75b53ce9cf36e2922869fe37b (patch)
tree684044a868a8a7e0eb3b8bdf58f0435d93ca1cd6
parent7ad7232422f7e5bbfa0e52dabe36c12677df19e2 (diff)
downloadrust-a75909824ac703f75b53ce9cf36e2922869fe37b.tar.gz
rust-a75909824ac703f75b53ce9cf36e2922869fe37b.zip
Remove now unnecessary code
This code was introduced in #27565 to mark types in paths alive. It is now unnecessary since #37676.
-rw-r--r--src/librustc/middle/dead.rs23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index 1bf6b837fd9..eb494685f49 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -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());
@@ -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);
@@ -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);
             }
             _ => ()
         }
@@ -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);
     }
 }