about summary refs log tree commit diff
path: root/src/test/compile-fail/lint-dead-code-1.rs
diff options
context:
space:
mode:
authorKiet Tran <ktt3ja@gmail.com>2014-01-11 03:21:53 -0500
committerKiet Tran <ktt3ja@gmail.com>2014-01-12 13:54:36 -0500
commitdeb3ca53a8d462d36283bdcb2ae796f25b3d2209 (patch)
tree784374731e0e2290f701b40285edfbd368c3164d /src/test/compile-fail/lint-dead-code-1.rs
parent1fda761e9cc5b5bf9d5f0897f1556958a7746bf5 (diff)
downloadrust-deb3ca53a8d462d36283bdcb2ae796f25b3d2209.tar.gz
rust-deb3ca53a8d462d36283bdcb2ae796f25b3d2209.zip
Mark allowed dead code and lang items as live
Dead code pass now explicitly checks for `#[allow(dead_code)]` and
`#[lang=".."]` attributes on items and marks them as live if they have
those attributes. The former is done so that if we want to suppress
warnings for a group of dead functions, we only have to annotate the
"root" of the call chain.
Diffstat (limited to 'src/test/compile-fail/lint-dead-code-1.rs')
-rw-r--r--src/test/compile-fail/lint-dead-code-1.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs
index b029866060d..8a9397b0227 100644
--- a/src/test/compile-fail/lint-dead-code-1.rs
+++ b/src/test/compile-fail/lint-dead-code-1.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[no_std];
 #[allow(unused_variable)];
 #[deny(dead_code)];
 
@@ -85,3 +86,13 @@ fn foo() { //~ ERROR: code is never used
 fn bar() { //~ ERROR: code is never used
     foo();
 }
+
+// Code with #[allow(dead_code)] should be marked live (and thus anything it
+// calls is marked live)
+#[allow(dead_code)]
+fn g() { h(); }
+fn h() {}
+
+// Similarly, lang items are live
+#[lang="fail_"]
+fn fail(_: *u8, _: *u8, _: uint) -> ! { loop {} }