Skip to content

Commit a759098

Browse files
committed
Remove now unnecessary code
This code was introduced in rust-lang#27565 to mark types in paths alive. It is now unnecessary since rust-lang#37676.
1 parent 7ad7232 commit a759098

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/librustc/middle/dead.rs

+5-18
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
8686
}
8787
}
8888

89-
fn handle_definition(&mut self, id: ast::NodeId, def: Def) {
90-
// If `bar` is a trait item, make sure to mark Foo as alive in `Foo::bar`
91-
match def {
92-
Def::AssociatedTy(..) | Def::Method(_) | Def::AssociatedConst(_)
93-
if self.tcx.trait_of_item(def.def_id()).is_some() => {
94-
if let Some(substs) = self.tcx.tables().item_substs.get(&id) {
95-
if let ty::TyAdt(tyid, _) = substs.substs.type_at(0).sty {
96-
self.check_def_id(tyid.did);
97-
}
98-
}
99-
}
100-
_ => {}
101-
}
102-
89+
fn handle_definition(&mut self, def: Def) {
10390
match def {
10491
Def::Const(_) | Def::AssociatedConst(..) => {
10592
self.check_def_id(def.def_id());
@@ -241,7 +228,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
241228
match expr.node {
242229
hir::ExprPath(ref qpath @ hir::QPath::TypeRelative(..)) => {
243230
let def = self.tcx.tables().qpath_def(qpath, expr.id);
244-
self.handle_definition(expr.id, def);
231+
self.handle_definition(def);
245232
}
246233
hir::ExprMethodCall(..) => {
247234
self.lookup_and_handle_method(expr.id);
@@ -281,7 +268,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
281268
}
282269
PatKind::Path(ref qpath @ hir::QPath::TypeRelative(..)) => {
283270
let def = self.tcx.tables().qpath_def(qpath, pat.id);
284-
self.handle_definition(pat.id, def);
271+
self.handle_definition(def);
285272
}
286273
_ => ()
287274
}
@@ -291,8 +278,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
291278
self.ignore_non_const_paths = false;
292279
}
293280

294-
fn visit_path(&mut self, path: &'tcx hir::Path, id: ast::NodeId) {
295-
self.handle_definition(id, path.def);
281+
fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) {
282+
self.handle_definition(path.def);
296283
intravisit::walk_path(self, path);
297284
}
298285
}

0 commit comments

Comments
 (0)