]> git.lizzy.rs Git - rust.git/commitdiff
Handle existential types in dead code analysis
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 3 Dec 2018 13:44:58 +0000 (14:44 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 3 Dec 2018 13:44:58 +0000 (14:44 +0100)
src/librustc/middle/dead.rs
src/test/ui/existential_types/private_unused.rs [new file with mode: 0644]

index 282b5d13e2c61067601c6705f7b62d1a7b4b042c..bb7a6a6ee7b7245d3bceb917ae5dddfdde0d9063 100644 (file)
@@ -166,6 +166,7 @@ fn visit_node(&mut self, node: &Node<'tcx>) {
                     hir::ItemKind::Fn(..)
                     | hir::ItemKind::Ty(..)
                     | hir::ItemKind::Static(..)
+                    | hir::ItemKind::Existential(..)
                     | hir::ItemKind::Const(..) => {
                         intravisit::walk_item(self, &item);
                     }
diff --git a/src/test/ui/existential_types/private_unused.rs b/src/test/ui/existential_types/private_unused.rs
new file mode 100644 (file)
index 0000000..736d812
--- /dev/null
@@ -0,0 +1,13 @@
+// compile-pass
+
+#[deny(warnings)]
+
+enum Empty { }
+trait Bar<T> {}
+impl Bar<Empty> for () {}
+
+fn boo() -> impl Bar<Empty> {}
+
+fn main() {
+    boo();
+}