diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-08-22 19:22:52 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-09-21 21:20:23 -0700 |
| commit | 35176867f62f76b9bc27267878f2d74d9c776221 (patch) | |
| tree | 95f178900cce7fab2c22b61a830aa05a2faf569b /src/libsyntax_ext | |
| parent | 17f56c549c35bb2cb316e5abff116e65277c7bb1 (diff) | |
only set non-ADT derive error once per attribute, not per trait
A slight eccentricity of this change is that now non-ADT-derive errors prevent derive-macro-not-found errors from surfacing (see changes to the gating-of-derive compile-fail tests). Resolves #43927.
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index d701810e2e9..5c1ca19d635 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -428,8 +428,9 @@ impl<'a> TraitDef<'a> { } } _ => { - cx.span_err(mitem.span, - "`derive` may only be applied to structs, enums and unions"); + // Non-ADT derive is an error, but it should have been + // set earlier; see + // libsyntax/ext/expand.rs:MacroExpander::expand() return; } }; @@ -448,8 +449,10 @@ impl<'a> TraitDef<'a> { push(Annotatable::Item(P(ast::Item { attrs: attrs, ..(*newitem).clone() }))) } _ => { - cx.span_err(mitem.span, - "`derive` may only be applied to structs and enums"); + // Non-Item derive is an error, but it should have been + // set earlier; see + // libsyntax/ext/expand.rs:MacroExpander::expand() + return; } } } |
