Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e82e472

Browse files
Update the test results for the proc macro attributes
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
1 parent 75d2715 commit e82e472

11 files changed

+263
-151
lines changed

‎tests/ui/attributes/malformed-attrs.stderr‎

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ error: malformed `no_sanitize` attribute input
6565
LL | #[no_sanitize]
6666
| ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]`
6767

68-
error: malformed `proc_macro` attribute input
69-
--> $DIR/malformed-attrs.rs:99:1
70-
|
71-
LL | #[proc_macro = 18]
72-
| ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro]`
73-
7468
error: malformed `instruction_set` attribute input
7569
--> $DIR/malformed-attrs.rs:106:1
7670
|
@@ -89,18 +83,6 @@ error: malformed `coroutine` attribute input
8983
LL | #[coroutine = 63] || {}
9084
| ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]`
9185

92-
error: malformed `proc_macro_attribute` attribute input
93-
--> $DIR/malformed-attrs.rs:116:1
94-
|
95-
LL | #[proc_macro_attribute = 19]
96-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_attribute]`
97-
98-
error: malformed `proc_macro_derive` attribute input
99-
--> $DIR/malformed-attrs.rs:123:1
100-
|
101-
LL | #[proc_macro_derive]
102-
| ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]`
103-
10486
error: malformed `must_not_suspend` attribute input
10587
--> $DIR/malformed-attrs.rs:132:1
10688
|
@@ -502,6 +484,24 @@ LL | #[no_implicit_prelude = 23]
502484
| | didn't expect any arguments here
503485
| help: must be of the form: `#[no_implicit_prelude]`
504486

487+
error[E0565]: malformed `proc_macro` attribute input
488+
--> $DIR/malformed-attrs.rs:99:1
489+
|
490+
LL | #[proc_macro = 18]
491+
| ^^^^^^^^^^^^^----^
492+
| | |
493+
| | didn't expect any arguments here
494+
| help: must be of the form: `#[proc_macro]`
495+
496+
error[E0565]: malformed `proc_macro_attribute` attribute input
497+
--> $DIR/malformed-attrs.rs:116:1
498+
|
499+
LL | #[proc_macro_attribute = 19]
500+
| ^^^^^^^^^^^^^^^^^^^^^^^----^
501+
| | |
502+
| | didn't expect any arguments here
503+
| help: must be of the form: `#[proc_macro_attribute]`
504+
505505
error[E0539]: malformed `must_use` attribute input
506506
--> $DIR/malformed-attrs.rs:119:1
507507
|
@@ -519,6 +519,15 @@ LL - #[must_use = 1]
519519
LL + #[must_use]
520520
|
521521

522+
error[E0539]: malformed `proc_macro_derive` attribute input
523+
--> $DIR/malformed-attrs.rs:123:1
524+
|
525+
LL | #[proc_macro_derive]
526+
| ^^^^^^^^^^^^^^^^^^^^
527+
| |
528+
| expected this to be a list
529+
| help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]`
530+
522531
error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
523532
--> $DIR/malformed-attrs.rs:128:1
524533
|

‎tests/ui/attributes/unsafe/proc-unsafe-attributes.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn b() {}
1212
#[proc_macro_derive(unsafe(Foo))]
1313
//~^ ERROR attribute is only usable with crates of the `proc-macro` crate type
1414
//~| ERROR: expected identifier, found keyword `unsafe`
15+
//~| ERROR malformed `proc_macro_derive` attribute input
1516
pub fn c() {}
1617

1718
#[unsafe(proc_macro_attribute)]

‎tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0452]: malformed lint attribute input
2-
--> $DIR/proc-unsafe-attributes.rs:26:16
2+
--> $DIR/proc-unsafe-attributes.rs:27:16
33
|
44
LL | #[unsafe(allow(unsafe(dead_code)))]
55
| ^^^^^^^^^^^^^^^^^ bad attribute argument
66

77
error[E0452]: malformed lint attribute input
8-
--> $DIR/proc-unsafe-attributes.rs:26:16
8+
--> $DIR/proc-unsafe-attributes.rs:27:16
99
|
1010
LL | #[unsafe(allow(unsafe(dead_code)))]
1111
| ^^^^^^^^^^^^^^^^^ bad attribute argument
@@ -40,31 +40,31 @@ LL | #[proc_macro_derive(r#unsafe(Foo))]
4040
| ++
4141

4242
error: `proc_macro_attribute` is not an unsafe attribute
43-
--> $DIR/proc-unsafe-attributes.rs:17:3
43+
--> $DIR/proc-unsafe-attributes.rs:18:3
4444
|
4545
LL | #[unsafe(proc_macro_attribute)]
4646
| ^^^^^^ this is not an unsafe attribute
4747
|
4848
= note: extraneous unsafe is not allowed in attributes
4949

5050
error: `allow` is not an unsafe attribute
51-
--> $DIR/proc-unsafe-attributes.rs:22:3
51+
--> $DIR/proc-unsafe-attributes.rs:23:3
5252
|
5353
LL | #[unsafe(allow(dead_code))]
5454
| ^^^^^^ this is not an unsafe attribute
5555
|
5656
= note: extraneous unsafe is not allowed in attributes
5757

5858
error: `allow` is not an unsafe attribute
59-
--> $DIR/proc-unsafe-attributes.rs:26:3
59+
--> $DIR/proc-unsafe-attributes.rs:27:3
6060
|
6161
LL | #[unsafe(allow(unsafe(dead_code)))]
6262
| ^^^^^^ this is not an unsafe attribute
6363
|
6464
= note: extraneous unsafe is not allowed in attributes
6565

6666
error: expected identifier, found keyword `unsafe`
67-
--> $DIR/proc-unsafe-attributes.rs:26:16
67+
--> $DIR/proc-unsafe-attributes.rs:27:16
6868
|
6969
LL | #[unsafe(allow(unsafe(dead_code)))]
7070
| ^^^^^^ expected identifier, found keyword
@@ -93,43 +93,53 @@ LL | #[proc_macro_derive(unsafe(Foo))]
9393
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9494

9595
error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
96-
--> $DIR/proc-unsafe-attributes.rs:17:1
96+
--> $DIR/proc-unsafe-attributes.rs:18:1
9797
|
9898
LL | #[unsafe(proc_macro_attribute)]
9999
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100100

101101
error[E0452]: malformed lint attribute input
102-
--> $DIR/proc-unsafe-attributes.rs:26:16
102+
--> $DIR/proc-unsafe-attributes.rs:27:16
103103
|
104104
LL | #[unsafe(allow(unsafe(dead_code)))]
105105
| ^^^^^^^^^^^^^^^^^ bad attribute argument
106106
|
107107
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
108108

109109
error[E0452]: malformed lint attribute input
110-
--> $DIR/proc-unsafe-attributes.rs:26:16
110+
--> $DIR/proc-unsafe-attributes.rs:27:16
111111
|
112112
LL | #[unsafe(allow(unsafe(dead_code)))]
113113
| ^^^^^^^^^^^^^^^^^ bad attribute argument
114114
|
115115
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
116116

117+
error[E0565]: malformed `proc_macro_derive` attribute input
118+
--> $DIR/proc-unsafe-attributes.rs:12:1
119+
|
120+
LL | #[proc_macro_derive(unsafe(Foo))]
121+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-----^^
122+
| | |
123+
| | didn't expect any arguments here
124+
| help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]`
125+
117126
error[E0452]: malformed lint attribute input
118-
--> $DIR/proc-unsafe-attributes.rs:26:16
127+
--> $DIR/proc-unsafe-attributes.rs:27:16
119128
|
120129
LL | #[unsafe(allow(unsafe(dead_code)))]
121130
| ^^^^^^^^^^^^^^^^^ bad attribute argument
122131
|
123132
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
124133

125134
error[E0452]: malformed lint attribute input
126-
--> $DIR/proc-unsafe-attributes.rs:26:16
135+
--> $DIR/proc-unsafe-attributes.rs:27:16
127136
|
128137
LL | #[unsafe(allow(unsafe(dead_code)))]
129138
| ^^^^^^^^^^^^^^^^^ bad attribute argument
130139
|
131140
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
132141

133-
error: aborting due to 17 previous errors
142+
error: aborting due to 18 previous errors
134143

135-
For more information about this error, try `rustc --explain E0452`.
144+
Some errors have detailed explanations: E0452, E0565.
145+
For more information about an error, try `rustc --explain E0452`.

‎tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
// see gated-link-args.rs
5858
// see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700"
5959
// (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
60-
#![proc_macro_derive()] //~ WARN `#[proc_macro_derive]` only has an effect
60+
#![proc_macro_derive(Test)] //~ WARN `#[proc_macro_derive]` only has an effect
6161
#![doc = "2400"]
6262
#![cold] //~ WARN attribute should be applied to a function
6363
//~^ WARN this was previously accepted

‎tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,6 @@ warning: `#[should_panic]` only has an effect on functions
367367
LL | #![should_panic]
368368
| ^^^^^^^^^^^^^^^^
369369

370-
warning: `#[proc_macro_derive]` only has an effect on functions
371-
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1
372-
|
373-
LL | #![proc_macro_derive()]
374-
| ^^^^^^^^^^^^^^^^^^^^^^^
375-
376370
warning: attribute should be applied to an `extern` block with non-Rust ABI
377371
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:64:1
378372
|
@@ -409,6 +403,12 @@ warning: `#[must_use]` has no effect when applied to a module
409403
LL | #![must_use]
410404
| ^^^^^^^^^^^^
411405

406+
warning: `#[proc_macro_derive]` only has an effect on functions
407+
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1
408+
|
409+
LL | #![proc_macro_derive(Test)]
410+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
411+
412412
warning: attribute should be applied to a function definition
413413
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:62:1
414414
|

‎tests/ui/feature-gates/issue-43106-gating-of-proc_macro_derive.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77
// signal errors, making it incompatible with the "warnings only"
88
// nature of issue-43106-gating-of-builtin-attrs.rs
99

10-
#[proc_macro_derive()]
10+
#[proc_macro_derive(Test)]
1111
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
1212
mod proc_macro_derive1 {
13-
mod inner { #![proc_macro_derive()] }
13+
mod inner { #![proc_macro_derive(Test)] }
1414
// (no error issued here if there was one on outer module)
1515
}
1616

1717
mod proc_macro_derive2 {
18-
mod inner { #![proc_macro_derive()] }
18+
mod inner { #![proc_macro_derive(Test)] }
1919
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
2020

21-
#[proc_macro_derive()] fn f() { }
21+
#[proc_macro_derive(Test)] fn f() { }
2222
//~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro`
2323

24-
#[proc_macro_derive()] struct S;
24+
#[proc_macro_derive(Test)] struct S;
2525
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
2626

27-
#[proc_macro_derive()] type T = S;
27+
#[proc_macro_derive(Test)] type T = S;
2828
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
2929

30-
#[proc_macro_derive()] impl S { }
30+
#[proc_macro_derive(Test)] impl S { }
3131
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
3232
}
3333

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
22
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:10:1
33
|
4-
LL | #[proc_macro_derive()]
5-
| ^^^^^^^^^^^^^^^^^^^^^^
4+
LL | #[proc_macro_derive(Test)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
88
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:18:17
99
|
10-
LL | mod inner { #![proc_macro_derive()] }
11-
| ^^^^^^^^^^^^^^^^^^^^^^^
10+
LL | mod inner { #![proc_macro_derive(Test)] }
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
1414
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:21:5
1515
|
16-
LL | #[proc_macro_derive()] fn f() { }
17-
| ^^^^^^^^^^^^^^^^^^^^^^
16+
LL | #[proc_macro_derive(Test)] fn f() { }
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
2020
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:24:5
2121
|
22-
LL | #[proc_macro_derive()] struct S;
23-
| ^^^^^^^^^^^^^^^^^^^^^^
22+
LL | #[proc_macro_derive(Test)] struct S;
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
2626
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:27:5
2727
|
28-
LL | #[proc_macro_derive()] type T = S;
29-
| ^^^^^^^^^^^^^^^^^^^^^^
28+
LL | #[proc_macro_derive(Test)] type T = S;
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
3030

3131
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
3232
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:30:5
3333
|
34-
LL | #[proc_macro_derive()] impl S { }
35-
| ^^^^^^^^^^^^^^^^^^^^^^
34+
LL | #[proc_macro_derive(Test)] impl S { }
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

3737
error: aborting due to 6 previous errors
3838

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /