about summary refs log tree commit diff
path: root/src/test/ui/modules
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2021-09-17 13:08:56 -0700
committerEric Huss <eric@huss.org>2021-09-25 09:03:15 -0700
commit75f058dbfd1c02daa191efb6eb53dc91fda8add6 (patch)
tree8348ab28c41ab996e2b534c28aa6d3a79d21d6b0 /src/test/ui/modules
parent5f8c571e50f1e0e98bb225e1dc909e73251a69be (diff)
downloadrust-75f058dbfd1c02daa191efb6eb53dc91fda8add6.tar.gz
rust-75f058dbfd1c02daa191efb6eb53dc91fda8add6.zip
Check for macros in built-in attributes that don't support them.
Diffstat (limited to 'src/test/ui/modules')
-rw-r--r--src/test/ui/modules/path-invalid-form.rs4
-rw-r--r--src/test/ui/modules/path-invalid-form.stderr8
-rw-r--r--src/test/ui/modules/path-macro.rs8
-rw-r--r--src/test/ui/modules/path-macro.stderr8
4 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/modules/path-invalid-form.rs b/src/test/ui/modules/path-invalid-form.rs
new file mode 100644
index 00000000000..713ef4a795d
--- /dev/null
+++ b/src/test/ui/modules/path-invalid-form.rs
@@ -0,0 +1,4 @@
+#[path = 123]  //~ ERROR malformed `path` attribute
+mod foo;
+
+fn main() {}
diff --git a/src/test/ui/modules/path-invalid-form.stderr b/src/test/ui/modules/path-invalid-form.stderr
new file mode 100644
index 00000000000..7e8aa44ef8b
--- /dev/null
+++ b/src/test/ui/modules/path-invalid-form.stderr
@@ -0,0 +1,8 @@
+error: malformed `path` attribute input
+  --> $DIR/path-invalid-form.rs:1:1
+   |
+LL | #[path = 123]
+   | ^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/modules/path-macro.rs b/src/test/ui/modules/path-macro.rs
new file mode 100644
index 00000000000..ce2d1e2da26
--- /dev/null
+++ b/src/test/ui/modules/path-macro.rs
@@ -0,0 +1,8 @@
+macro_rules! foo {
+    () => {"bar.rs"};
+}
+
+#[path = foo!()] //~ ERROR malformed `path` attribute
+mod abc;
+
+fn main() {}
diff --git a/src/test/ui/modules/path-macro.stderr b/src/test/ui/modules/path-macro.stderr
new file mode 100644
index 00000000000..9a2e01ea264
--- /dev/null
+++ b/src/test/ui/modules/path-macro.stderr
@@ -0,0 +1,8 @@
+error: malformed `path` attribute input
+  --> $DIR/path-macro.rs:5:1
+   |
+LL | #[path = foo!()]
+   | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]`
+
+error: aborting due to previous error
+