// from live codes are live, and everything else is dead.
use crate::hir::Node;
-use crate::hir::{self, PatKind};
+use crate::hir::{self, PatKind, TyKind};
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
use crate::hir::itemlikevisit::ItemLikeVisitor;
self.handle_definition(path.def);
intravisit::walk_path(self, path);
}
+
+ fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
+ match ty.node {
+ TyKind::Def(item_id, _) => {
+ let item = self.tcx.hir().expect_item(item_id.id);
+ intravisit::walk_item(self, item);
+ }
+ _ => ()
+ }
+ intravisit::walk_ty(self, ty);
+ }
}
fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
--- /dev/null
+error: type alias is never used: `Unused`
+ --> $DIR/lint-dead-code-impl-trait.rs:12:1
+ |
+LL | type Unused = ();
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-impl-trait.rs:1:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+