Skip to content

Commit fb52aea

Browse files
committed
tests: Centralize proc macros commonly used for testing
1 parent 50a0def commit fb52aea

File tree

72 files changed

+475
-649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+475
-649
lines changed

src/test/ui/custom-derive/auxiliary/plugin.rs

-28
This file was deleted.

src/test/ui/custom-derive/derive-in-mod.rs

-13
This file was deleted.

src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs

-12
This file was deleted.

src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr

-21
This file was deleted.

src/test/ui/custom-derive/helper-attr-blocked-by-import.rs

-28
This file was deleted.

src/test/ui/custom-derive/issue-36935.rs

-12
This file was deleted.

src/test/ui/custom-derive/issue-36935.stderr

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// aux-build:attr_proc_macro.rs
1+
// aux-build:test-macros.rs
22

3-
extern crate attr_proc_macro;
4-
use attr_proc_macro::*;
3+
#[macro_use]
4+
extern crate test_macros;
55

6-
#[attr_proc_macro] // OK
6+
#[identity_attr] // OK
77
#[derive(Clone)]
88
struct Before;
99

1010
#[derive(Clone)]
11-
#[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]`
11+
#[identity_attr] //~ ERROR macro attributes must be placed before `#[derive]`
1212
struct After;
1313

1414
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: macro attributes must be placed before `#[derive]`
22
--> $DIR/attribute-order-restricted.rs:11:1
33
|
4-
LL | #[attr_proc_macro]
5-
| ^^^^^^^^^^^^^^^^^^
4+
LL | #[identity_attr]
5+
| ^^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error
88

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// aux-build:attribute-with-error.rs
1+
// aux-build:test-macros.rs
22

33
#![feature(custom_inner_attributes)]
44

5-
extern crate attribute_with_error;
5+
#[macro_use]
6+
extern crate test_macros;
67

7-
use attribute_with_error::foo;
8-
9-
#[foo]
8+
#[recollect_attr]
109
fn test1() {
1110
let a: i32 = "foo";
1211
//~^ ERROR: mismatched types
@@ -15,13 +14,13 @@ fn test1() {
1514
}
1615

1716
fn test2() {
18-
#![foo]
17+
#![recollect_attr]
1918

2019
// FIXME: should have a type error here and assert it works but it doesn't
2120
}
2221

2322
trait A {
24-
// FIXME: should have a #[foo] attribute here and assert that it works
23+
// FIXME: should have a #[recollect_attr] attribute here and assert that it works
2524
fn foo(&self) {
2625
let a: i32 = "foo";
2726
//~^ ERROR: mismatched types
@@ -31,13 +30,13 @@ trait A {
3130
struct B;
3231

3332
impl A for B {
34-
#[foo]
33+
#[recollect_attr]
3534
fn foo(&self) {
3635
let a: i32 = "foo";
3736
//~^ ERROR: mismatched types
3837
}
3938
}
4039

41-
#[foo]
40+
#[recollect_attr]
4241
fn main() {
4342
}

src/test/ui/proc-macro/attribute-with-error.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/attribute-with-error.rs:11:18
2+
--> $DIR/attribute-with-error.rs:10:18
33
|
44
LL | let a: i32 = "foo";
55
| ^^^^^ expected i32, found reference
@@ -8,7 +8,7 @@ LL | let a: i32 = "foo";
88
found type `&'static str`
99

1010
error[E0308]: mismatched types
11-
--> $DIR/attribute-with-error.rs:13:18
11+
--> $DIR/attribute-with-error.rs:12:18
1212
|
1313
LL | let b: i32 = "f'oo";
1414
| ^^^^^^ expected i32, found reference
@@ -17,7 +17,7 @@ LL | let b: i32 = "f'oo";
1717
found type `&'static str`
1818

1919
error[E0308]: mismatched types
20-
--> $DIR/attribute-with-error.rs:26:22
20+
--> $DIR/attribute-with-error.rs:25:22
2121
|
2222
LL | let a: i32 = "foo";
2323
| ^^^^^ expected i32, found reference
@@ -26,7 +26,7 @@ LL | let a: i32 = "foo";
2626
found type `&'static str`
2727

2828
error[E0308]: mismatched types
29-
--> $DIR/attribute-with-error.rs:36:22
29+
--> $DIR/attribute-with-error.rs:35:22
3030
|
3131
LL | let a: i32 = "foo";
3232
| ^^^^^ expected i32, found reference

src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs

-13
This file was deleted.

src/test/ui/proc-macro/auxiliary/attribute-with-error.rs

-13
This file was deleted.

src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs

-13
This file was deleted.

src/test/ui/proc-macro/auxiliary/derive-a-b.rs

-17
This file was deleted.

src/test/ui/proc-macro/auxiliary/derive-a.rs

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#[macro_export]
2-
macro_rules! my_attr { () => () }
2+
macro_rules! empty_helper { () => () }

src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs

-12
This file was deleted.

src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs

-17
This file was deleted.

src/test/ui/proc-macro/auxiliary/derive-panic.rs

-13
This file was deleted.

src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ pub type S = u8;
33
#[macro_export]
44
macro_rules! external {
55
() => {
6-
dollar_crate::m! {
6+
print_bang! {
77
struct M($crate::S);
88
}
99

10-
#[dollar_crate::a]
10+
#[print_attr]
1111
struct A($crate::S);
1212

13-
#[derive(dollar_crate::d)]
13+
#[derive(Print)]
1414
struct D($crate::S);
1515
};
1616
}

0 commit comments

Comments
 (0)