expansion: Remove restriction on use of macro attributes with test/bench

The restrictions were introduced in https://github.com/rust-lang/rust/pull/54277 and no longer necessary now because legacy plugins are now expanded in usual left-to-right order
This commit is contained in:
Vadim Petrochenkov 2018-09-19 01:46:18 +03:00
parent 60a1d4e6c2
commit 8994c6d417
7 changed files with 44 additions and 114 deletions

View file

@ -19,8 +19,8 @@
#[macro_use] #[no_link]
extern crate macro_crate_test;
#[derive(PartialEq, Clone, Debug)]
#[rustc_into_multi_foo]
#[derive(PartialEq, Clone, Debug)]
fn foo() -> AnotherFakeTypeThatHadBetterGoAway {}
// Check that the `#[into_multi_foo]`-generated `foo2` is configured away

View file

@ -1,9 +1,5 @@
// aux-build:attr_proc_macro.rs
// compile-flags:--test
#![feature(test)]
extern crate test;
extern crate attr_proc_macro;
use attr_proc_macro::*;
@ -15,18 +11,4 @@ struct Before;
#[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]`
struct After;
#[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
#[test]
fn test_before() {}
#[test]
#[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
fn test_after() {}
#[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
#[bench]
fn bench_before(b: &mut test::Bencher) {}
#[bench]
#[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
fn bench_after(b: &mut test::Bencher) {}
fn main() {}

View file

@ -1,32 +1,8 @@
error: macro attributes must be placed before `#[derive]`
--> $DIR/attribute-order-restricted.rs:15:1
--> $DIR/attribute-order-restricted.rs:11:1
|
LL | #[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]`
| ^^^^^^^^^^^^^^^^^^
error: macro attributes cannot be used together with `#[test]` or `#[bench]`
--> $DIR/attribute-order-restricted.rs:18:1
|
LL | #[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
| ^^^^^^^^^^^^^^^^^^
error: macro attributes cannot be used together with `#[test]` or `#[bench]`
--> $DIR/attribute-order-restricted.rs:23:1
|
LL | #[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
| ^^^^^^^^^^^^^^^^^^
error: macro attributes cannot be used together with `#[test]` or `#[bench]`
--> $DIR/attribute-order-restricted.rs:26:1
|
LL | #[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
| ^^^^^^^^^^^^^^^^^^
error: macro attributes cannot be used together with `#[test]` or `#[bench]`
--> $DIR/attribute-order-restricted.rs:31:1
|
LL | #[attr_proc_macro] //~ ERROR macro attributes cannot be used together with `#[test]` or `#[bench]`
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors
error: aborting due to previous error