summaryrefslogtreecommitdiffstats
path: root/src/test/ui/used.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/used.rs')
-rw-r--r--src/test/ui/used.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/used.rs b/src/test/ui/used.rs
new file mode 100644
index 000000000..f008724f4
--- /dev/null
+++ b/src/test/ui/used.rs
@@ -0,0 +1,16 @@
+#[used]
+static FOO: u32 = 0; // OK
+
+#[used] //~ ERROR attribute must be applied to a `static` variable
+fn foo() {}
+
+#[used] //~ ERROR attribute must be applied to a `static` variable
+struct Foo {}
+
+#[used] //~ ERROR attribute must be applied to a `static` variable
+trait Bar {}
+
+#[used] //~ ERROR attribute must be applied to a `static` variable
+impl Bar for Foo {}
+
+fn main() {}