From 14abb550bf676d221866e5ad5f588850d018acbf Mon Sep 17 00:00:00 2001 From: Steve Pentland Date: Tue, 1 May 2018 19:57:42 -0400 Subject: Add ability to apply custom derive to union types. The Union item type has been included in the allowed types for a custom derive. Closes #50223 --- src/libsyntax_ext/deriving/custom.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libsyntax_ext') 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() } } -- cgit 1.4.1-3-g733a5