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.
This commit is contained in:
parent
17f56c549c
commit
35176867f6
6 changed files with 52 additions and 30 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue