about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-03-05 23:03:42 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-04-05 13:59:53 -0500
commitbc1bd8a609823814079996ca3ca0b05774e07a74 (patch)
treeb7e58bf9978b2d65f869bd556952bb698bd7e503
parent4c7e27734031d8b57cb51ad498d7f5111032468d (diff)
downloadrust-bc1bd8a609823814079996ca3ca0b05774e07a74.tar.gz
rust-bc1bd8a609823814079996ca3ca0b05774e07a74.zip
add tracking issue and feature-gate and run-make tests
-rw-r--r--src/test/compile-fail/feature-gate-used.rs15
-rw-r--r--src/test/run-make/used/Makefile12
-rw-r--r--src/test/run-make/used/used.rs17
3 files changed, 44 insertions, 0 deletions
diff --git a/src/test/compile-fail/feature-gate-used.rs b/src/test/compile-fail/feature-gate-used.rs
new file mode 100644
index 00000000000..68679d7dac8
--- /dev/null
+++ b/src/test/compile-fail/feature-gate-used.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[used]
+fn foo() {}
+//~^^ ERROR the `#[used]` attribute is an experimental feature
+
+fn main() {}
diff --git a/src/test/run-make/used/Makefile b/src/test/run-make/used/Makefile
new file mode 100644
index 00000000000..70ac2e3802b
--- /dev/null
+++ b/src/test/run-make/used/Makefile
@@ -0,0 +1,12 @@
+-include ../tools.mk
+
+ifdef IS_WINDOWS
+# Do nothing on MSVC.
+all:
+	exit 0
+else
+all:
+	$(RUSTC) -C opt-level=3 --emit=obj used.rs
+	nm -C used.o | grep FOO
+	nm -C used.o | grep -v BAR
+endif
diff --git a/src/test/run-make/used/used.rs b/src/test/run-make/used/used.rs
new file mode 100644
index 00000000000..186cd0fdf5e
--- /dev/null
+++ b/src/test/run-make/used/used.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "lib"]
+#![feature(used)]
+
+#[used]
+static FOO: u32 = 0;
+
+static BAR: u32 = 0;