Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
| hir::ItemKind::Ty(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Existential(..)
| hir::ItemKind::Impl(..)
| hir::ItemKind::Const(..) => {
intravisit::walk_item(self, &item);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove _ => () and replace with "exhaustive" match to avoid future problems?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure why this is not

_ => {
    intravisit::walk_item(self, &item);
}

If that doesn't break anything, then walk_item can be moved out of the match.

Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/dead-code-impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// run-pass

#![deny(dead_code)]

pub struct GenericFoo<T>(T);

type Foo = GenericFoo<u32>;

impl Foo {
fn bar(self) -> u8 {
0
}
}

fn main() {
println!("{}", GenericFoo(0).bar());
}