Skip to content

Commit

Permalink
Fix proc macro tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mejrs committed Jan 19, 2023
1 parent a8e3abd commit 8e43414
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 19 deletions.
2 changes: 2 additions & 0 deletions tests/ui/proc-macro/allowed-signatures.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// check-pass
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]
#![allow(private_in_public)]
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/proc-macro/proc-macro-abi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]
#![allow(warnings)]

Expand Down
6 changes: 3 additions & 3 deletions tests/ui/proc-macro/proc-macro-abi.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: proc macro functions may not be `extern "C"`
--> $DIR/proc-macro-abi.rs:8:1
--> $DIR/proc-macro-abi.rs:11:1
|
LL | pub extern "C" fn abi(a: TokenStream) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

error: proc macro functions may not be `extern "C"`
--> $DIR/proc-macro-abi.rs:20:1
--> $DIR/proc-macro-abi.rs:23:1
|
LL | pub extern fn abi3(a: TokenStream) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/proc-macro/signature-proc-macro-attribute.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/proc-macro/signature-proc-macro-attribute.stderr
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
error: mismatched attribute proc macro signature
--> $DIR/signature-proc-macro-attribute.rs:7:1
--> $DIR/signature-proc-macro-attribute.rs:10:1
|
LL | pub fn bad_input(input: String) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream`

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

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

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

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

error: mismatched attribute proc macro signature
--> $DIR/signature-proc-macro-attribute.rs:27:49
--> $DIR/signature-proc-macro-attribute.rs:30:49
|
LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream {
| ^^^^^^^^^ found unexpected argument
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/proc-macro/signature-proc-macro-derive.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/proc-macro/signature-proc-macro-derive.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
error: mismatched derive proc macro signature
--> $DIR/signature-proc-macro-derive.rs:7:25
--> $DIR/signature-proc-macro-derive.rs:10:25
|
LL | pub fn bad_input(input: String) -> TokenStream {
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
|
= note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream`

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

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

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

error: mismatched derive proc macro signature
--> $DIR/signature-proc-macro-derive.rs:26:33
--> $DIR/signature-proc-macro-derive.rs:29:33
|
LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/proc-macro/signature-proc-macro.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/proc-macro/signature-proc-macro.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
error: mismatched function-like proc macro signature
--> $DIR/signature-proc-macro.rs:7:25
--> $DIR/signature-proc-macro.rs:10:25
|
LL | pub fn bad_input(input: String) -> TokenStream {
| ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream`
|
= note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream`

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

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

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

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

0 comments on commit 8e43414

Please sign in to comment.