diff options
| author | Steve Pentland <stevepentland@gmail.com> | 2018-05-01 19:57:42 -0400 |
|---|---|---|
| committer | Steve Pentland <stevepentland@gmail.com> | 2018-06-18 21:34:11 -0400 |
| commit | 14abb550bf676d221866e5ad5f588850d018acbf (patch) | |
| tree | bee4262b4b596c163910bce96f51d3bb15e6df37 /src/libsyntax_ext | |
| parent | 5230979794db209de492b3f7cc688020b72bc7c6 (diff) | |
| download | rust-14abb550bf676d221866e5ad5f588850d018acbf.tar.gz rust-14abb550bf676d221866e5ad5f588850d018acbf.zip | |
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
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/deriving/custom.rs | 7 |
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() } } |
