about summary refs log tree commit diff
path: root/tests/ui/tool-attributes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/tool-attributes')
-rw-r--r--tests/ui/tool-attributes/crate-attr.rs5
-rw-r--r--tests/ui/tool-attributes/multiple-registered.rs7
-rw-r--r--tests/ui/tool-attributes/nested-disallowed.rs4
-rw-r--r--tests/ui/tool-attributes/nested-disallowed.stderr8
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/tool-attributes/crate-attr.rs b/tests/ui/tool-attributes/crate-attr.rs
new file mode 100644
index 00000000000..c6d7974945f
--- /dev/null
+++ b/tests/ui/tool-attributes/crate-attr.rs
@@ -0,0 +1,5 @@
+//@ check-pass
+//@ compile-flags: -Z crate-attr=feature(register_tool) -Z crate-attr=register_tool(foo)
+
+#[allow(foo::bar)]
+fn main() {}
diff --git a/tests/ui/tool-attributes/multiple-registered.rs b/tests/ui/tool-attributes/multiple-registered.rs
new file mode 100644
index 00000000000..4d54c2dcb08
--- /dev/null
+++ b/tests/ui/tool-attributes/multiple-registered.rs
@@ -0,0 +1,7 @@
+//@ check-pass
+
+#![feature(register_tool)]
+#![register_tool(foo, bar, baz)]
+
+#[allow(foo::a, bar::b, baz::c)]
+fn main() {}
diff --git a/tests/ui/tool-attributes/nested-disallowed.rs b/tests/ui/tool-attributes/nested-disallowed.rs
new file mode 100644
index 00000000000..8e780427761
--- /dev/null
+++ b/tests/ui/tool-attributes/nested-disallowed.rs
@@ -0,0 +1,4 @@
+#![feature(register_tool)]
+#![register_tool(foo::bar)] //~ ERROR only accepts identifiers
+
+fn main() {}
diff --git a/tests/ui/tool-attributes/nested-disallowed.stderr b/tests/ui/tool-attributes/nested-disallowed.stderr
new file mode 100644
index 00000000000..1af73fc2f19
--- /dev/null
+++ b/tests/ui/tool-attributes/nested-disallowed.stderr
@@ -0,0 +1,8 @@
+error: `register_tool` only accepts identifiers
+  --> $DIR/nested-disallowed.rs:2:18
+   |
+LL | #![register_tool(foo::bar)]
+   |                  ^^^^^^^^ not an identifier
+
+error: aborting due to 1 previous error
+