Skip to content

Commit ac137f6

Browse files
committed
auto merge of #11009 : ktt3ja/rust/issue-11006, r=alexcrichton
Fix #11006.
2 parents bf30a21 + 05a41dc commit ac137f6

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/librustc/middle/dead.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,9 @@ impl Visitor<()> for MarkSymbolVisitor {
158158
visit::walk_expr(self, expr, ())
159159
}
160160

161-
fn visit_ty(&mut self, typ: &ast::Ty, _: ()) {
162-
match typ.node {
163-
ast::ty_path(_, _, ref id) => {
164-
self.lookup_and_handle_definition(id);
165-
}
166-
_ => visit::walk_ty(self, typ, ()),
167-
}
168-
}
169-
170-
fn visit_path(&mut self, _: &ast::Path, id: ast::NodeId, _: ()) {
161+
fn visit_path(&mut self, path: &ast::Path, id: ast::NodeId, _: ()) {
171162
self.lookup_and_handle_definition(&id);
163+
visit::walk_path(self, path, ());
172164
}
173165

174166
fn visit_item(&mut self, _item: @ast::item, _: ()) {

src/test/compile-fail/lint-dead-code-1.rs

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ impl SemiUsedStruct {
4444
}
4545
struct StructUsedAsField;
4646
struct StructUsedInEnum;
47+
struct StructUsedInGeneric;
4748
pub struct PubStruct2 {
4849
struct_used_as_field: *StructUsedAsField
4950
}
@@ -54,6 +55,8 @@ pub enum pub_enum3 { Foo = STATIC_USED_IN_ENUM_DISCRIMINANT }
5455
enum priv_enum { foo2, bar2 } //~ ERROR: code is never used
5556
enum used_enum { foo3, bar3 }
5657

58+
fn f<T>() {}
59+
5760
pub fn pub_fn() {
5861
used_fn();
5962
let used_struct1 = UsedStruct1 { x: 1 };
@@ -67,6 +70,7 @@ pub fn pub_fn() {
6770
USED_STATIC => (),
6871
_ => ()
6972
}
73+
f::<StructUsedInGeneric>();
7074
}
7175
fn priv_fn() { //~ ERROR: code is never used
7276
let unused_struct = PrivStruct;

0 commit comments

Comments
 (0)