]> git.lizzy.rs Git - rust.git/commit
Make #[derive(Anything)] into sugar for #[derive_Anything]
authorKeegan McAllister <kmcallister@mozilla.com>
Fri, 6 Mar 2015 21:15:54 +0000 (13:15 -0800)
committerKeegan McAllister <kmcallister@mozilla.com>
Sat, 7 Mar 2015 02:20:16 +0000 (18:20 -0800)
commit491054f08e2aaaa8438f1a9943f115dad9da1c6b
tree7ab7e4dfd5b60e7d3d3aedb501065da17bc35204
parente60e6f0693adfd03340dff31023c7517dc3af1b5
Make #[derive(Anything)] into sugar for #[derive_Anything]

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.

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

    [breaking-change]
14 files changed:
src/doc/reference.md
src/libsyntax/ext/base.rs
src/libsyntax/ext/deriving/bounds.rs
src/libsyntax/ext/deriving/mod.rs
src/libsyntax/ext/expand.rs
src/libsyntax/feature_gate.rs
src/test/auxiliary/custom_derive_plugin.rs [new file with mode: 0644]
src/test/compile-fail/deriving-bounds.rs
src/test/compile-fail/deriving-meta-unknown-trait.rs
src/test/compile-fail/malformed-derive-entry.rs [new file with mode: 0644]
src/test/compile-fail/single-derive-attr.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/derive-totalsum.rs [new file with mode: 0644]
src/test/run-pass/deprecated-derive.rs [new file with mode: 0644]
src/test/run-pass/single-derive-attr-with-gate.rs [new file with mode: 0644]