about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-19 08:50:41 +0000
committerbors <bors@rust-lang.org>2018-06-19 08:50:41 +0000
commit1080203e9788d2e2dee46bf4d2abbb1c7535ee45 (patch)
treea8e84392259635629595c79ea5865f97b968214f /src/libsyntax_ext
parent1cfb628eade1fc41d2dc57aafe5ca637c777f3c2 (diff)
parent14abb550bf676d221866e5ad5f588850d018acbf (diff)
downloadrust-1080203e9788d2e2dee46bf4d2abbb1c7535ee45.tar.gz
rust-1080203e9788d2e2dee46bf4d2abbb1c7535ee45.zip
Auto merge of #50383 - stevepentland:union-derive, r=oli-obk
Add ability to apply custom derive to union types.

The Union item type has been included in the allowed types for a custom derive.
fyi @abonander

Closes #50223
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/deriving/custom.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs
index 76da1746a03..c3958bb58dd 100644
--- a/src/libsyntax_ext/deriving/custom.rs
+++ b/src/libsyntax_ext/deriving/custom.rs
@@ -57,16 +57,17 @@ impl MultiItemModifier for ProcMacroDerive {
             Annotatable::Stmt(_) |
             Annotatable::Expr(_) => {
                 ecx.span_err(span, "proc-macro derives may only be \
-                                    applied to struct/enum items");
+                                    applied to a struct, enum, or union");
                 return Vec::new()
             }
         };
         match item.node {
             ItemKind::Struct(..) |
-            ItemKind::Enum(..) => {},
+            ItemKind::Enum(..) |
+            ItemKind::Union(..) => {},
             _ => {
                 ecx.span_err(span, "proc-macro derives may only be \
-                                    applied to struct/enum items");
+                                    applied to a struct, enum, or union");
                 return Vec::new()
             }
         }