diff options
Diffstat (limited to 'vendor/proc-macro-hack/tests')
-rw-r--r-- | vendor/proc-macro-hack/tests/compiletest.rs | 6 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/private.rs | 8 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/private.stderr | 5 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/unexpected-arg.rs | 8 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/unexpected-arg.stderr | 5 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/unexpected.rs | 6 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/unexpected.stderr | 5 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/unknown-arg.rs | 6 | ||||
-rw-r--r-- | vendor/proc-macro-hack/tests/ui/unknown-arg.stderr | 5 |
9 files changed, 54 insertions, 0 deletions
diff --git a/vendor/proc-macro-hack/tests/compiletest.rs b/vendor/proc-macro-hack/tests/compiletest.rs new file mode 100644 index 000000000..f9aea23b5 --- /dev/null +++ b/vendor/proc-macro-hack/tests/compiletest.rs @@ -0,0 +1,6 @@ +#[rustversion::attr(not(nightly), ignore)] +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("tests/ui/*.rs"); +} diff --git a/vendor/proc-macro-hack/tests/ui/private.rs b/vendor/proc-macro-hack/tests/ui/private.rs new file mode 100644 index 000000000..1ab84446c --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/private.rs @@ -0,0 +1,8 @@ +use proc_macro_hack::proc_macro_hack; + +#[proc_macro_hack] +fn my_macro(input: TokenStream) -> TokenStream { + unimplemented!() +} + +fn main() {} diff --git a/vendor/proc-macro-hack/tests/ui/private.stderr b/vendor/proc-macro-hack/tests/ui/private.stderr new file mode 100644 index 000000000..be794438c --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/private.stderr @@ -0,0 +1,5 @@ +error: functions tagged with `#[proc_macro_hack]` must be `pub` + --> $DIR/private.rs:4:1 + | +4 | fn my_macro(input: TokenStream) -> TokenStream { + | ^^ diff --git a/vendor/proc-macro-hack/tests/ui/unexpected-arg.rs b/vendor/proc-macro-hack/tests/ui/unexpected-arg.rs new file mode 100644 index 000000000..376fc0d98 --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/unexpected-arg.rs @@ -0,0 +1,8 @@ +use proc_macro_hack::proc_macro_hack; + +#[proc_macro_hack(fake_call_site)] +pub fn my_macro(input: TokenStream) -> TokenStream { + unimplemented!() +} + +fn main() {} diff --git a/vendor/proc-macro-hack/tests/ui/unexpected-arg.stderr b/vendor/proc-macro-hack/tests/ui/unexpected-arg.stderr new file mode 100644 index 000000000..6895e82ee --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/unexpected-arg.stderr @@ -0,0 +1,5 @@ +error: unexpected argument to proc_macro_hack macro implementation; args are only accepted on the macro declaration (the `pub use`) + --> $DIR/unexpected-arg.rs:3:19 + | +3 | #[proc_macro_hack(fake_call_site)] + | ^^^^^^^^^^^^^^ diff --git a/vendor/proc-macro-hack/tests/ui/unexpected.rs b/vendor/proc-macro-hack/tests/ui/unexpected.rs new file mode 100644 index 000000000..122ded519 --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/unexpected.rs @@ -0,0 +1,6 @@ +use proc_macro_hack::proc_macro_hack; + +#[proc_macro_hack] +pub struct What; + +fn main() {} diff --git a/vendor/proc-macro-hack/tests/ui/unexpected.stderr b/vendor/proc-macro-hack/tests/ui/unexpected.stderr new file mode 100644 index 000000000..e3da97a95 --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/unexpected.stderr @@ -0,0 +1,5 @@ +error: unexpected input to #[proc_macro_hack] + --> $DIR/unexpected.rs:4:5 + | +4 | pub struct What; + | ^^^^^^ diff --git a/vendor/proc-macro-hack/tests/ui/unknown-arg.rs b/vendor/proc-macro-hack/tests/ui/unknown-arg.rs new file mode 100644 index 000000000..aa9b82c8f --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/unknown-arg.rs @@ -0,0 +1,6 @@ +use proc_macro_hack::proc_macro_hack; + +#[proc_macro_hack(fake_call_site, support_nexted)] +pub use demo::some_macro; + +fn main() {} diff --git a/vendor/proc-macro-hack/tests/ui/unknown-arg.stderr b/vendor/proc-macro-hack/tests/ui/unknown-arg.stderr new file mode 100644 index 000000000..ffe3705dd --- /dev/null +++ b/vendor/proc-macro-hack/tests/ui/unknown-arg.stderr @@ -0,0 +1,5 @@ +error: expected one of: `support_nested`, `internal_macro_calls`, `fake_call_site`, `only_hack_old_rustc` + --> $DIR/unknown-arg.rs:3:35 + | +3 | #[proc_macro_hack(fake_call_site, support_nexted)] + | ^^^^^^^^^^^^^^ |