Auto merge of #23137 - kmcallister:derive-sugar, r=sfackler

This is a hack, but I don't think we can do much better as long as `derive` is running at the syntax expansion phase.

If the `custom_derive` feature gate is enabled, this works with user-defined traits and syntax extensions. Without the gate, you can't use e.g. `#[derive_Clone]` directly, so this does not change the stable language.

To make this effective, we now check gated attributes both before and after macro expansion. This uncovered a number of tests that were missing feature gates.

This PR also cleans up the deriving code somewhat, and forbids some previously-meaningless attribute syntax. For this reason it's technically a

    [breaking-change]

r? @sfackler
This commit is contained in:
bors 2015-03-07 18:39:17 +00:00
commit 668c647408
24 changed files with 468 additions and 205 deletions

View file

@ -2429,6 +2429,10 @@ The currently implemented features of the reference compiler are:
so that new attributes can be added in a bacwards compatible
manner (RFC 572).
* `custom_derive` - Allows the use of `#[derive(Foo,Bar)]` as sugar for
`#[derive_Foo] #[derive_Bar]`, which can be user-defined syntax
extensions.
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
are inherently unstable and no promise about them is made.