summaryrefslogtreecommitdiffstats
path: root/third_party/rust/proc-macro-hack/tests/ui
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/proc-macro-hack/tests/ui
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/proc-macro-hack/tests/ui')
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/private.rs8
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/private.stderr5
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/unexpected-arg.rs8
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/unexpected-arg.stderr5
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/unexpected.rs6
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/unexpected.stderr5
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/unknown-arg.rs6
-rw-r--r--third_party/rust/proc-macro-hack/tests/ui/unknown-arg.stderr5
8 files changed, 48 insertions, 0 deletions
diff --git a/third_party/rust/proc-macro-hack/tests/ui/private.rs b/third_party/rust/proc-macro-hack/tests/ui/private.rs
new file mode 100644
index 0000000000..1ab84446c7
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/proc-macro-hack/tests/ui/private.stderr b/third_party/rust/proc-macro-hack/tests/ui/private.stderr
new file mode 100644
index 0000000000..d3a3ea7ed4
--- /dev/null
+++ b/third_party/rust/proc-macro-hack/tests/ui/private.stderr
@@ -0,0 +1,5 @@
+error: functions tagged with `#[proc_macro_hack]` must be `pub`
+ --> tests/ui/private.rs:4:1
+ |
+4 | fn my_macro(input: TokenStream) -> TokenStream {
+ | ^^
diff --git a/third_party/rust/proc-macro-hack/tests/ui/unexpected-arg.rs b/third_party/rust/proc-macro-hack/tests/ui/unexpected-arg.rs
new file mode 100644
index 0000000000..376fc0d986
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/proc-macro-hack/tests/ui/unexpected-arg.stderr b/third_party/rust/proc-macro-hack/tests/ui/unexpected-arg.stderr
new file mode 100644
index 0000000000..f32f05a1cd
--- /dev/null
+++ b/third_party/rust/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`)
+ --> tests/ui/unexpected-arg.rs:3:19
+ |
+3 | #[proc_macro_hack(fake_call_site)]
+ | ^^^^^^^^^^^^^^
diff --git a/third_party/rust/proc-macro-hack/tests/ui/unexpected.rs b/third_party/rust/proc-macro-hack/tests/ui/unexpected.rs
new file mode 100644
index 0000000000..122ded5191
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/proc-macro-hack/tests/ui/unexpected.stderr b/third_party/rust/proc-macro-hack/tests/ui/unexpected.stderr
new file mode 100644
index 0000000000..60761b5149
--- /dev/null
+++ b/third_party/rust/proc-macro-hack/tests/ui/unexpected.stderr
@@ -0,0 +1,5 @@
+error: unexpected input to #[proc_macro_hack]
+ --> tests/ui/unexpected.rs:4:5
+ |
+4 | pub struct What;
+ | ^^^^^^
diff --git a/third_party/rust/proc-macro-hack/tests/ui/unknown-arg.rs b/third_party/rust/proc-macro-hack/tests/ui/unknown-arg.rs
new file mode 100644
index 0000000000..aa9b82c8f4
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/proc-macro-hack/tests/ui/unknown-arg.stderr b/third_party/rust/proc-macro-hack/tests/ui/unknown-arg.stderr
new file mode 100644
index 0000000000..772e6673d0
--- /dev/null
+++ b/third_party/rust/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`
+ --> tests/ui/unknown-arg.rs:3:35
+ |
+3 | #[proc_macro_hack(fake_call_site, support_nexted)]
+ | ^^^^^^^^^^^^^^