about summary refs log tree commit diff
path: root/src/libsyntax_expand/proc_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax_expand/proc_macro.rs')
-rw-r--r--src/libsyntax_expand/proc_macro.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax_expand/proc_macro.rs b/src/libsyntax_expand/proc_macro.rs
index 07b618c99a5..81465665498 100644
--- a/src/libsyntax_expand/proc_macro.rs
+++ b/src/libsyntax_expand/proc_macro.rs
@@ -200,7 +200,14 @@ crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>)
             return false;
         }
 
-        match attr.parse_derive_paths(cx.parse_sess) {
+        let parse_derive_paths = |attr: &ast::Attribute| {
+            if attr.tokens.is_empty() {
+                return Ok(Vec::new());
+            }
+            parse::parse_in_attr(cx.parse_sess, attr, |p| p.parse_derive_paths())
+        };
+
+        match parse_derive_paths(attr) {
             Ok(traits) => {
                 result.extend(traits);
                 true