Fix proc macro tests

This commit is contained in:
mejrs 2023-01-19 16:31:50 +01:00
parent a8e3abd04c
commit 8e43414bce
9 changed files with 33 additions and 19 deletions

View File

@ -1,4 +1,6 @@
// check-pass
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
#![allow(private_in_public)]

View File

@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
#![allow(warnings)]

View File

@ -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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;

View File

@ -1,11 +1,11 @@
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`
@ -13,13 +13,13 @@ LL | pub fn bad_output(input: TokenStream) -> String {
= 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`
@ -27,13 +27,13 @@ LL | pub fn bad_everything(input: String) -> String {
= 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

View File

@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;

View File

@ -1,5 +1,5 @@
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`
@ -7,7 +7,7 @@ LL | pub fn bad_input(input: String) -> 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`
@ -15,7 +15,7 @@ LL | pub fn bad_output(input: TokenStream) -> String {
= 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`
@ -23,7 +23,7 @@ LL | pub fn bad_everything(input: String) -> String {
= 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`
@ -31,7 +31,7 @@ LL | pub fn bad_everything(input: String) -> String {
= 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

View File

@ -1,3 +1,6 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;

View File

@ -1,5 +1,5 @@
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`
@ -7,7 +7,7 @@ LL | pub fn bad_input(input: String) -> 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`
@ -15,7 +15,7 @@ LL | pub fn bad_output(input: TokenStream) -> String {
= 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`
@ -23,7 +23,7 @@ LL | pub fn bad_everything(input: String) -> String {
= 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`
@ -31,7 +31,7 @@ LL | pub fn bad_everything(input: String) -> String {
= 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