about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-08 11:16:19 +0000
committerbors <bors@rust-lang.org>2020-12-08 11:16:19 +0000
commit5019791e2d4ac67b4c5c56853600a02f4b84e515 (patch)
tree5821caf1950f46b3b31f44ddcf913fb2da3da634 /src
parent4fd4a98d4788bc987d7f7add9df5f5ead6a1c15e (diff)
parent37853f925f115eae8b2a3750d071de6af32309e7 (diff)
downloadrust-5019791e2d4ac67b4c5c56853600a02f4b84e515.tar.gz
rust-5019791e2d4ac67b4c5c56853600a02f4b84e515.zip
Auto merge of #79752 - cjgillot:dead-alien, r=lcnr
Visit ForeignItems when marking dead code

Follow-up to #79318

r? `@lcnr`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/lint/dead-code/type-in-foreign.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/lint/dead-code/type-in-foreign.rs b/src/test/ui/lint/dead-code/type-in-foreign.rs
new file mode 100644
index 00000000000..b6c593f316f
--- /dev/null
+++ b/src/test/ui/lint/dead-code/type-in-foreign.rs
@@ -0,0 +1,19 @@
+// Verify that we do not warn on types that are used by foreign functions.
+// check-pass
+#![deny(dead_code)]
+
+#[repr(C)]
+struct Type(u8);
+
+#[repr(C)]
+struct Param(u8);
+
+extern "C" {
+    #[allow(dead_code)]
+    fn hey(t: Param);
+
+    #[allow(dead_code)]
+    static much: Type;
+}
+
+fn main() {}