Check even more live Path nodes in dead-code pass
This commit is contained in:
parent
35e5056b6a
commit
05a41dc75f
@ -158,17 +158,9 @@ impl Visitor<()> for MarkSymbolVisitor {
|
||||
visit::walk_expr(self, expr, ())
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, typ: &ast::Ty, _: ()) {
|
||||
match typ.node {
|
||||
ast::ty_path(_, _, ref id) => {
|
||||
self.lookup_and_handle_definition(id);
|
||||
}
|
||||
_ => visit::walk_ty(self, typ, ()),
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, _: &ast::Path, id: ast::NodeId, _: ()) {
|
||||
fn visit_path(&mut self, path: &ast::Path, id: ast::NodeId, _: ()) {
|
||||
self.lookup_and_handle_definition(&id);
|
||||
visit::walk_path(self, path, ());
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, _item: @ast::item, _: ()) {
|
||||
|
@ -44,6 +44,7 @@ impl SemiUsedStruct {
|
||||
}
|
||||
struct StructUsedAsField;
|
||||
struct StructUsedInEnum;
|
||||
struct StructUsedInGeneric;
|
||||
pub struct PubStruct2 {
|
||||
struct_used_as_field: *StructUsedAsField
|
||||
}
|
||||
@ -54,6 +55,8 @@ pub enum pub_enum3 { Foo = STATIC_USED_IN_ENUM_DISCRIMINANT }
|
||||
enum priv_enum { foo2, bar2 } //~ ERROR: code is never used
|
||||
enum used_enum { foo3, bar3 }
|
||||
|
||||
fn f<T>() {}
|
||||
|
||||
pub fn pub_fn() {
|
||||
used_fn();
|
||||
let used_struct1 = UsedStruct1 { x: 1 };
|
||||
@ -67,6 +70,7 @@ pub fn pub_fn() {
|
||||
USED_STATIC => (),
|
||||
_ => ()
|
||||
}
|
||||
f::<StructUsedInGeneric>();
|
||||
}
|
||||
fn priv_fn() { //~ ERROR: code is never used
|
||||
let unused_struct = PrivStruct;
|
||||
|
Loading…
x
Reference in New Issue
Block a user