summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs')
-rw-r--r--tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs b/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs
new file mode 100644
index 000000000..54f2f451b
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs
@@ -0,0 +1,66 @@
+// aux-build:ident-mac.rs
+
+#![feature(c_variadic)]
+#![allow(anonymous_parameters)]
+
+extern crate ident_mac;
+use ident_mac::id;
+
+struct W(u8);
+
+extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
+//~^ ERROR expected non-macro attribute, found attribute macro
+//~| ERROR expected non-macro attribute, found attribute macro
+
+unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
+//~^ ERROR expected non-macro attribute, found attribute macro
+
+type Alias = extern "C" fn(#[id] u8, #[id] ...);
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+
+fn free(#[id] arg1: u8) {
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ let lam = |#[id] W(x), #[id] y: usize| ();
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+}
+
+impl W {
+ fn inherent1(#[id] self, #[id] arg1: u8) {}
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn inherent2(#[id] &self, #[id] arg1: u8) {}
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+}
+
+trait A {
+ fn trait1(#[id] self, #[id] arg1: u8);
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn trait2(#[id] &self, #[id] arg1: u8);
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+ fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
+ //~^ ERROR expected non-macro attribute, found attribute macro
+ //~| ERROR expected non-macro attribute, found attribute macro
+}
+
+fn main() {}