about summary refs log tree commit diff
path: root/src/test/ui/proc-macro/attribute-after-derive.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-11-14 14:47:14 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2021-02-07 20:08:45 +0300
commitdbdbd30bf2cb0d48c8bbce83c2458592664dbb18 (patch)
tree92877e16f45e3cf927ffc4296e0f90c48ec036f5 /src/test/ui/proc-macro/attribute-after-derive.rs
parentae00b62ceb7eaf1f02f5289ab233bf7e0e8060d5 (diff)
downloadrust-dbdbd30bf2cb0d48c8bbce83c2458592664dbb18.tar.gz
rust-dbdbd30bf2cb0d48c8bbce83c2458592664dbb18.zip
expand/resolve: Turn `#[derive]` into a regular macro attribute
Diffstat (limited to 'src/test/ui/proc-macro/attribute-after-derive.rs')
-rw-r--r--src/test/ui/proc-macro/attribute-after-derive.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/attribute-after-derive.rs b/src/test/ui/proc-macro/attribute-after-derive.rs
new file mode 100644
index 00000000000..0f0f27bff97
--- /dev/null
+++ b/src/test/ui/proc-macro/attribute-after-derive.rs
@@ -0,0 +1,28 @@
+// Macro attributes are allowed after `#[derive]` and
+// `#[derive]` fully configures the item for following attributes.
+
+// check-pass
+// compile-flags: -Z span-debug
+// aux-build: test-macros.rs
+
+#![no_std] // Don't load unnecessary hygiene information from std
+extern crate std;
+
+#[macro_use]
+extern crate test_macros;
+
+#[print_attr]
+#[derive(Print)]
+struct AttributeDerive {
+    #[cfg(FALSE)]
+    field: u8,
+}
+
+#[derive(Print)]
+#[print_attr]
+struct DeriveAttribute {
+    #[cfg(FALSE)]
+    field: u8,
+}
+
+fn main() {}