]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #54277 - petrochenkov:afterder, r=alexcrichton
authorbors <bors@rust-lang.org>
Mon, 17 Sep 2018 18:13:26 +0000 (18:13 +0000)
committerbors <bors@rust-lang.org>
Mon, 17 Sep 2018 18:13:26 +0000 (18:13 +0000)
Temporarily prohibit proc macro attributes placed after derives

... and also proc macro attributes used together with `#[test]`/`#[bench]`.

Addresses item 6 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393.

The end goal is straightforward predictable left-to-right expansion order for attributes.
Right now derives are expanded last regardless of their relative ordering with macro attributes and right now it's simpler to temporarily prohibit macro attributes placed after derives than changing the expansion order.
I'm not sure whether the new beta is already released or not, but if it's released, then this patch needs to be backported, so the solution needs to be minimal.

How to fix broken code (derives):
- Move macro attributes above derives. This won't change expansion order, they are expanded before derives anyway.

Using attribute macros on same items with `#[test]` and `#[bench]` is prohibited for similar expansion order reasons, but this one is going to be reverted much sooner than restrictions on derives.

How to fix broken code (test/bench):
- Enable `#![feature(plugin)]` (don't ask why).

r? @ghost

1  2 
src/librustc_resolve/macros.rs

Simple merge