summaryrefslogtreecommitdiff
path: root/tests/ui/attributes/key-value-expansion-scope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/attributes/key-value-expansion-scope.rs')
-rw-r--r--tests/ui/attributes/key-value-expansion-scope.rs64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/ui/attributes/key-value-expansion-scope.rs b/tests/ui/attributes/key-value-expansion-scope.rs
new file mode 100644
index 00000000000..f435e36ce63
--- /dev/null
+++ b/tests/ui/attributes/key-value-expansion-scope.rs
@@ -0,0 +1,64 @@
+#![doc = in_root!()] // FIXME, this is a bug
+#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
+#![doc = in_mod_escape!()] // FIXME, this is a bug
+#![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
+
+#[doc = in_root!()] //~ ERROR cannot find macro `in_root` in this scope
+#[doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
+#[doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
+#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
+fn before() {
+ #![doc = in_root!()] //~ ERROR cannot find macro `in_root` in this scope
+ #![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
+ #![doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
+ #![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
+}
+
+macro_rules! in_root { () => { "" } }
+
+mod macros_stay {
+ #![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
+
+ macro_rules! in_mod { () => { "" } }
+
+ #[doc = in_mod!()] // OK
+ fn f() {
+ #![doc = in_mod!()] // OK
+ }
+}
+
+#[macro_use]
+mod macros_escape {
+ #![doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
+
+ macro_rules! in_mod_escape { () => { "" } }
+
+ #[doc = in_mod_escape!()] // OK
+ fn f() {
+ #![doc = in_mod_escape!()] // OK
+ }
+}
+
+fn block() {
+ #![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
+
+ macro_rules! in_block { () => { "" } }
+
+ #[doc = in_block!()] // OK
+ fn f() {
+ #![doc = in_block!()] // OK
+ }
+}
+
+#[doc = in_root!()] // OK
+#[doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
+#[doc = in_mod_escape!()] // OK
+#[doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
+fn after() {
+ #![doc = in_root!()] // OK
+ #![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
+ #![doc = in_mod_escape!()] // OK
+ #![doc = in_block!()] //~ ERROR cannot find macro `in_block` in this scope
+}
+
+fn main() {}