Skip to content

Commit 8e43414

Browse files
committed
Fix proc macro tests
1 parent a8e3abd commit 8e43414

9 files changed

+33
-19
lines changed

tests/ui/proc-macro/allowed-signatures.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// check-pass
2+
// force-host
3+
// no-prefer-dynamic
24

35
#![crate_type = "proc-macro"]
46
#![allow(private_in_public)]

tests/ui/proc-macro/proc-macro-abi.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
14
#![crate_type = "proc-macro"]
25
#![allow(warnings)]
36

tests/ui/proc-macro/proc-macro-abi.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: proc macro functions may not be `extern "C"`
2-
--> $DIR/proc-macro-abi.rs:8:1
2+
--> $DIR/proc-macro-abi.rs:11:1
33
|
44
LL | pub extern "C" fn abi(a: TokenStream) -> TokenStream {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: proc macro functions may not be `extern "system"`
8-
--> $DIR/proc-macro-abi.rs:14:1
8+
--> $DIR/proc-macro-abi.rs:17:1
99
|
1010
LL | pub extern "system" fn abi2(a: TokenStream) -> TokenStream {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: proc macro functions may not be `extern "C"`
14-
--> $DIR/proc-macro-abi.rs:20:1
14+
--> $DIR/proc-macro-abi.rs:23:1
1515
|
1616
LL | pub extern fn abi3(a: TokenStream) -> TokenStream {
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/proc-macro/signature-proc-macro-attribute.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
14
#![crate_type = "proc-macro"]
25

36
extern crate proc_macro;

tests/ui/proc-macro/signature-proc-macro-attribute.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
error: mismatched attribute proc macro signature
2-
--> $DIR/signature-proc-macro-attribute.rs:7:1
2+
--> $DIR/signature-proc-macro-attribute.rs:10:1
33
|
44
LL | pub fn bad_input(input: String) -> TokenStream {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream`
66

77
error: mismatched attribute proc macro signature
8-
--> $DIR/signature-proc-macro-attribute.rs:13:42
8+
--> $DIR/signature-proc-macro-attribute.rs:16:42
99
|
1010
LL | pub fn bad_output(input: TokenStream) -> String {
1111
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
1212
|
1313
= note: attribute proc macros must have a signature of `fn(TokenStream, TokenStream) -> TokenStream`
1414

1515
error: mismatched attribute proc macro signature
16-
--> $DIR/signature-proc-macro-attribute.rs:13:1
16+
--> $DIR/signature-proc-macro-attribute.rs:16:1
1717
|
1818
LL | pub fn bad_output(input: TokenStream) -> String {
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream`
2020

2121
error: mismatched attribute proc macro signature
22-
--> $DIR/signature-proc-macro-attribute.rs:20:41
22+
--> $DIR/signature-proc-macro-attribute.rs:23:41
2323
|
2424
LL | pub fn bad_everything(input: String) -> String {
2525
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
2626
|
2727
= note: attribute proc macros must have a signature of `fn(TokenStream, TokenStream) -> TokenStream`
2828

2929
error: mismatched attribute proc macro signature
30-
--> $DIR/signature-proc-macro-attribute.rs:20:1
30+
--> $DIR/signature-proc-macro-attribute.rs:23:1
3131
|
3232
LL | pub fn bad_everything(input: String) -> String {
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream`
3434

3535
error: mismatched attribute proc macro signature
36-
--> $DIR/signature-proc-macro-attribute.rs:27:49
36+
--> $DIR/signature-proc-macro-attribute.rs:30:49
3737
|
3838
LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream {
3939
| ^^^^^^^^^ found unexpected argument

tests/ui/proc-macro/signature-proc-macro-derive.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
14
#![crate_type = "proc-macro"]
25

36
extern crate proc_macro;

tests/ui/proc-macro/signature-proc-macro-derive.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
error: mismatched derive proc macro signature
2-
--> $DIR/signature-proc-macro-derive.rs:7:25
2+
--> $DIR/signature-proc-macro-derive.rs:10:25
33
|
44
LL | pub fn bad_input(input: String) -> TokenStream {
55
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
66
|
77
= note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream`
88

99
error: mismatched derive proc macro signature
10-
--> $DIR/signature-proc-macro-derive.rs:13:42
10+
--> $DIR/signature-proc-macro-derive.rs:16:42
1111
|
1212
LL | pub fn bad_output(input: TokenStream) -> String {
1313
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
1414
|
1515
= note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream`
1616

1717
error: mismatched derive proc macro signature
18-
--> $DIR/signature-proc-macro-derive.rs:19:41
18+
--> $DIR/signature-proc-macro-derive.rs:22:41
1919
|
2020
LL | pub fn bad_everything(input: String) -> String {
2121
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
2222
|
2323
= note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream`
2424

2525
error: mismatched derive proc macro signature
26-
--> $DIR/signature-proc-macro-derive.rs:19:30
26+
--> $DIR/signature-proc-macro-derive.rs:22:30
2727
|
2828
LL | pub fn bad_everything(input: String) -> String {
2929
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
3030
|
3131
= note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream`
3232

3333
error: mismatched derive proc macro signature
34-
--> $DIR/signature-proc-macro-derive.rs:26:33
34+
--> $DIR/signature-proc-macro-derive.rs:29:33
3535
|
3636
LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream {
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments

tests/ui/proc-macro/signature-proc-macro.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
14
#![crate_type = "proc-macro"]
25

36
extern crate proc_macro;

tests/ui/proc-macro/signature-proc-macro.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
error: mismatched function-like proc macro signature
2-
--> $DIR/signature-proc-macro.rs:7:25
2+
--> $DIR/signature-proc-macro.rs:10:25
33
|
44
LL | pub fn bad_input(input: String) -> TokenStream {
55
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
66
|
77
= note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream`
88

99
error: mismatched function-like proc macro signature
10-
--> $DIR/signature-proc-macro.rs:13:42
10+
--> $DIR/signature-proc-macro.rs:16:42
1111
|
1212
LL | pub fn bad_output(input: TokenStream) -> String {
1313
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
1414
|
1515
= note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream`
1616

1717
error: mismatched function-like proc macro signature
18-
--> $DIR/signature-proc-macro.rs:19:41
18+
--> $DIR/signature-proc-macro.rs:22:41
1919
|
2020
LL | pub fn bad_everything(input: String) -> String {
2121
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
2222
|
2323
= note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream`
2424

2525
error: mismatched function-like proc macro signature
26-
--> $DIR/signature-proc-macro.rs:19:30
26+
--> $DIR/signature-proc-macro.rs:22:30
2727
|
2828
LL | pub fn bad_everything(input: String) -> String {
2929
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
3030
|
3131
= note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream`
3232

3333
error: mismatched function-like proc macro signature
34-
--> $DIR/signature-proc-macro.rs:26:33
34+
--> $DIR/signature-proc-macro.rs:29:33
3535
|
3636
LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream {
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments

0 commit comments

Comments
 (0)