about summary refs log tree commit diff
path: root/src/test/ui/modules/path-macro.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-09-26 05:15:11 +0000
committerbors <bors@rust-lang.org>2021-09-26 05:15:11 +0000
commitf6e6ddc09d660fbfb4d483a9677d80768cc4e31c (patch)
tree61b3e7fda85f83fa96d221012da392502e7d1cf6 /src/test/ui/modules/path-macro.rs
parent4da89a180facdecf168cbe0ddbc6bfbdd9f6e696 (diff)
parent75f058dbfd1c02daa191efb6eb53dc91fda8add6 (diff)
Auto merge of #88680 - ehuss:more-attr-validation, r=petrochenkov
Validate builtin attributes for macro args.

This adds some validation for `path`, `crate_type`, and `recursion_limit` attributes so that they will now return an error if you attempt to pass a macro into them (such as `#[path = foo!()]`). Previously, the attribute would be completely ignored. These attributes are special because their values need to be known before/during expansion.

cc #87681
Diffstat (limited to 'src/test/ui/modules/path-macro.rs')
-rw-r--r--src/test/ui/modules/path-macro.rs8
1 files changed, 8 insertions, 0 deletions
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() {}