auto merge of #11009 : ktt3ja/rust/issue-11006, r=alexcrichton

Fix #11006.
This commit is contained in:
bors 2013-12-17 15:51:35 -08:00
commit ac137f6dbe
2 changed files with 6 additions and 10 deletions

View file

@ -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, _: ()) {

View file

@ -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;