about summary refs log tree commit diff
path: root/tests/ui/rfc-2565-param-attrs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfc-2565-param-attrs')
-rw-r--r--tests/ui/rfc-2565-param-attrs/attr-without-param.rs16
-rw-r--r--tests/ui/rfc-2565-param-attrs/attr-without-param.stderr20
-rw-r--r--tests/ui/rfc-2565-param-attrs/auxiliary/ident-mac.rs11
-rw-r--r--tests/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs43
-rw-r--r--tests/ui/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs21
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-2018.rs6
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-2018.stderr22
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-allowed.rs101
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs174
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr386
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-cfg.rs121
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr122
-rw-r--r--tests/ui/rfc-2565-param-attrs/param-attrs-pretty.rs61
-rw-r--r--tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs66
-rw-r--r--tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr176
15 files changed, 1346 insertions, 0 deletions
diff --git a/tests/ui/rfc-2565-param-attrs/attr-without-param.rs b/tests/ui/rfc-2565-param-attrs/attr-without-param.rs
new file mode 100644
index 00000000000..eeb2191bab4
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/attr-without-param.rs
@@ -0,0 +1,16 @@
+#[cfg(FALSE)]
+impl S {
+    fn f(#[attr]) {} //~ ERROR expected parameter name, found `)`
+}
+
+#[cfg(FALSE)]
+impl T for S {
+    fn f(#[attr]) {} //~ ERROR expected parameter name, found `)`
+}
+
+#[cfg(FALSE)]
+trait T {
+    fn f(#[attr]); //~ ERROR expected argument name, found `)`
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2565-param-attrs/attr-without-param.stderr b/tests/ui/rfc-2565-param-attrs/attr-without-param.stderr
new file mode 100644
index 00000000000..26dff4d4b30
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/attr-without-param.stderr
@@ -0,0 +1,20 @@
+error: expected parameter name, found `)`
+  --> $DIR/attr-without-param.rs:3:17
+   |
+LL |     fn f(#[attr]) {}
+   |                 ^ expected parameter name
+
+error: expected parameter name, found `)`
+  --> $DIR/attr-without-param.rs:8:17
+   |
+LL |     fn f(#[attr]) {}
+   |                 ^ expected parameter name
+
+error: expected argument name, found `)`
+  --> $DIR/attr-without-param.rs:13:17
+   |
+LL |     fn f(#[attr]);
+   |                 ^ expected argument name
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/rfc-2565-param-attrs/auxiliary/ident-mac.rs b/tests/ui/rfc-2565-param-attrs/auxiliary/ident-mac.rs
new file mode 100644
index 00000000000..b62cf31205f
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/auxiliary/ident-mac.rs
@@ -0,0 +1,11 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn id(_: TokenStream, input: TokenStream) -> TokenStream { input }
diff --git a/tests/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs b/tests/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs
new file mode 100644
index 00000000000..82c4120b4c7
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs
@@ -0,0 +1,43 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+macro_rules! checker {
+    ($attr_name:ident, $expected:literal) => {
+        #[proc_macro_attribute]
+        pub fn $attr_name(attr: TokenStream, input: TokenStream) -> TokenStream {
+            assert_eq!(input.to_string(), $expected);
+            TokenStream::new()
+        }
+    }
+}
+
+checker!(attr_extern, r#"extern "C" { fn ffi(#[a1] arg1 : i32, #[a2] ...) ; }"#);
+checker!(attr_extern_cvar, r#"unsafe extern "C" fn cvar(arg1 : i32, #[a1] mut args : ...) {}"#);
+checker!(attr_alias, "type Alias = fn(#[a1] u8, #[a2] ...) ;");
+checker!(attr_free, "fn free(#[a1] arg1 : u8) { let lam = | #[a2] W(x), #[a3] y | () ; }");
+checker!(attr_inherent_1, "fn inherent1(#[a1] self, #[a2] arg1 : u8) {}");
+checker!(attr_inherent_2, "fn inherent2(#[a1] & self, #[a2] arg1 : u8) {}");
+checker!(attr_inherent_3, "fn inherent3 < 'a > (#[a1] & 'a mut self, #[a2] arg1 : u8) {}");
+checker!(attr_inherent_4, "fn inherent4 < 'a > (#[a1] self : Box < Self >, #[a2] arg1 : u8) {}");
+checker!(attr_inherent_issue_64682, "fn inherent5(#[a1] #[a2] arg1 : u8, #[a3] arg2 : u8) {}");
+checker!(attr_trait_1, "fn trait1(#[a1] self, #[a2] arg1 : u8) ;");
+checker!(attr_trait_2, "fn trait2(#[a1] & self, #[a2] arg1 : u8) ;");
+checker!(attr_trait_3, "fn trait3 < 'a > (#[a1] & 'a mut self, #[a2] arg1 : u8) ;");
+checker!(attr_trait_4, r#"fn trait4 < 'a >
+(#[a1] self : Box < Self >, #[a2] arg1 : u8, #[a3] Vec < u8 >) ;"#);
+checker!(attr_trait_issue_64682, "fn trait5(#[a1] #[a2] arg1 : u8, #[a3] arg2 : u8) ;");
+checker!(rename_params, r#"impl Foo
+{
+    fn hello(#[angery(true)] a : i32, #[a2] b : i32, #[what = "how"] c : u32)
+    {} fn
+    hello2(#[a1] #[a2] a : i32, #[what = "how"] b : i32, #[angery(true)] c :
+    u32) {} fn
+    hello_self(#[a1] #[a2] & self, #[a1] #[a2] a : i32, #[what = "how"] b :
+    i32, #[angery(true)] c : u32) {}
+}"#);
diff --git a/tests/ui/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs b/tests/ui/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs
new file mode 100644
index 00000000000..670303906d2
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs
@@ -0,0 +1,21 @@
+// aux-build:param-attrs.rs
+
+// check-pass
+
+extern crate param_attrs;
+
+use param_attrs::rename_params;
+
+#[rename_params(send_help)]
+impl Foo {
+    fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) {}
+    fn hello2(#[a1] #[a2] a: i32, #[what = "how"] b: i32, #[angery(true)] c: u32) {}
+    fn hello_self(
+        #[a1] #[a2] &self,
+        #[a1] #[a2] a: i32,
+        #[what = "how"] b: i32,
+        #[angery(true)] c: u32
+    ) {}
+}
+
+fn main() {}
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-2018.rs b/tests/ui/rfc-2565-param-attrs/param-attrs-2018.rs
new file mode 100644
index 00000000000..a6f693bd5b5
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-2018.rs
@@ -0,0 +1,6 @@
+// edition:2018
+
+trait Trait2015 { fn foo(#[allow(C)] i32); }
+//~^ ERROR expected one of `:`, `@`, or `|`, found `)`
+
+fn main() {}
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-2018.stderr b/tests/ui/rfc-2565-param-attrs/param-attrs-2018.stderr
new file mode 100644
index 00000000000..593821bf961
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-2018.stderr
@@ -0,0 +1,22 @@
+error: expected one of `:`, `@`, or `|`, found `)`
+  --> $DIR/param-attrs-2018.rs:3:41
+   |
+LL | trait Trait2015 { fn foo(#[allow(C)] i32); }
+   |                                         ^ expected one of `:`, `@`, or `|`
+   |
+   = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
+help: if this is a `self` type, give it a parameter name
+   |
+LL | trait Trait2015 { fn foo(#[allow(C)] self: i32); }
+   |                                      +++++
+help: if this is a parameter name, give it a type
+   |
+LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
+   |                                         ++++++++++
+help: if this is a type, explicitly ignore the parameter name
+   |
+LL | trait Trait2015 { fn foo(#[allow(C)] _: i32); }
+   |                                      ++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-allowed.rs b/tests/ui/rfc-2565-param-attrs/param-attrs-allowed.rs
new file mode 100644
index 00000000000..a547d09d048
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-allowed.rs
@@ -0,0 +1,101 @@
+// check-pass
+// compile-flags: --cfg something
+
+#![deny(unused_mut)]
+
+extern "C" {
+    fn ffi(
+        #[allow(unused_mut)] a: i32,
+        #[cfg(something)] b: i32,
+        #[cfg_attr(something, cfg(nothing))] c: i32,
+        #[forbid(unused_mut)] d: i32,
+        #[deny(unused_mut)] #[warn(unused_mut)] ...
+    );
+}
+
+type FnType = fn(
+    #[allow(unused_mut)] a: i32,
+    #[cfg(something)] b: i32,
+    #[cfg_attr(something, cfg(nothing))] c: i32,
+    #[forbid(unused_mut)] d: i32,
+    #[deny(unused_mut)] #[warn(unused_mut)] e: i32
+);
+
+pub fn foo(
+    #[allow(unused_mut)] a: i32,
+    #[cfg(something)] b: i32,
+    #[cfg_attr(something, cfg(nothing))] c: i32,
+    #[forbid(unused_mut)] d: i32,
+    #[deny(unused_mut)] #[warn(unused_mut)] _e: i32
+) {}
+
+// self
+
+struct SelfStruct {}
+impl SelfStruct {
+    fn foo(
+        #[allow(unused_mut)] self,
+        #[cfg(something)] a: i32,
+        #[cfg_attr(something, cfg(nothing))]
+        #[deny(unused_mut)] b: i32,
+    ) {}
+}
+
+struct RefStruct {}
+impl RefStruct {
+    fn foo(
+        #[allow(unused_mut)] &self,
+        #[cfg(something)] a: i32,
+        #[cfg_attr(something, cfg(nothing))]
+        #[deny(unused_mut)] b: i32,
+    ) {}
+}
+trait RefTrait {
+    fn foo(
+        #[forbid(unused_mut)] &self,
+        #[warn(unused_mut)] a: i32
+    ) {}
+}
+impl RefTrait for RefStruct {
+    fn foo(
+        #[forbid(unused_mut)] &self,
+        #[warn(unused_mut)] a: i32
+    ) {}
+}
+
+// Box<Self>
+
+struct BoxSelfStruct {}
+impl BoxSelfStruct {
+    fn foo(
+        #[allow(unused_mut)] self: Box<Self>,
+        #[cfg(something)] a: i32,
+        #[cfg_attr(something, cfg(nothing))]
+        #[deny(unused_mut)] b: i32,
+    ) {}
+}
+trait BoxSelfTrait {
+    fn foo(
+        #[forbid(unused_mut)] self: Box<Self>,
+        #[warn(unused_mut)] a: i32
+    ) {}
+}
+impl BoxSelfTrait for BoxSelfStruct {
+    fn foo(
+        #[forbid(unused_mut)] self: Box<Self>,
+        #[warn(unused_mut)] a: i32
+    ) {}
+}
+
+fn main() {
+    let _: unsafe extern "C" fn(_, _, _, ...) = ffi;
+    let _: fn(_, _, _, _) = foo;
+    let _: FnType = |_, _, _, _| {};
+    let c = |
+        #[allow(unused_mut)] a: u32,
+        #[cfg(something)] b: i32,
+        #[cfg_attr(something, cfg(nothing))]
+        #[deny(unused_mut)] c: i32,
+    | {};
+    let _ = c(1, 2);
+}
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs b/tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs
new file mode 100644
index 00000000000..151659e35c0
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs
@@ -0,0 +1,174 @@
+extern "C" {
+    fn ffi(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Bar
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    );
+}
+
+type FnType = fn(
+    /// Foo
+    //~^ ERROR documentation comments cannot be applied to function
+    #[test] a: u32,
+    //~^ ERROR expected non-macro attribute, found attribute macro
+    /// Bar
+    //~^ ERROR documentation comments cannot be applied to function
+    #[must_use]
+    //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    /// Baz
+    //~^ ERROR documentation comments cannot be applied to function
+    #[no_mangle] b: i32,
+    //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+);
+
+pub fn foo(
+    /// Foo
+    //~^ ERROR documentation comments cannot be applied to function
+    #[test] a: u32,
+    //~^ ERROR expected non-macro attribute, found attribute macro
+    /// Bar
+    //~^ ERROR documentation comments cannot be applied to function
+    #[must_use]
+    //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    /// Baz
+    //~^ ERROR documentation comments cannot be applied to function
+    #[no_mangle] b: i32,
+    //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+) {}
+
+struct SelfStruct {}
+impl SelfStruct {
+    fn foo(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        self,
+        /// Bar
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Qux
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    ) {}
+
+    fn issue_64682_associated_fn(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Qux
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    ) {}
+}
+
+struct RefStruct {}
+impl RefStruct {
+    fn foo(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        &self,
+        /// Bar
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Qux
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    ) {}
+}
+trait RefTrait {
+    fn foo(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        &self,
+        /// Bar
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Qux
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    ) {}
+
+    fn issue_64682_associated_fn(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Qux
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    ) {}
+}
+
+impl RefTrait for RefStruct {
+    fn foo(
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        &self,
+        /// Bar
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: i32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Qux
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32,
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    ) {}
+}
+
+fn main() {
+    let _ = |
+        /// Foo
+        //~^ ERROR documentation comments cannot be applied to function
+        #[test] a: u32,
+        //~^ ERROR expected non-macro attribute, found attribute macro
+        /// Bar
+        //~^ ERROR documentation comments cannot be applied to function
+        #[must_use]
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+        /// Baz
+        //~^ ERROR documentation comments cannot be applied to function
+        #[no_mangle] b: i32
+        //~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+    | {};
+}
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr b/tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr
new file mode 100644
index 00000000000..7573e39d8eb
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr
@@ -0,0 +1,386 @@
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:5:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:21:7
+   |
+LL |     #[test] a: u32,
+   |       ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:36:7
+   |
+LL |     #[test] a: u32,
+   |       ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:56:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:71:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:92:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:111:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:126:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:146:11
+   |
+LL |         #[test] a: i32,
+   |           ^^^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `test`
+  --> $DIR/param-attrs-builtin-attrs.rs:163:11
+   |
+LL |         #[test] a: u32,
+   |           ^^^^ not a non-macro attribute
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:3:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:7:9
+   |
+LL |         /// Bar
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:9:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:11:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:13:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:19:5
+   |
+LL |     /// Foo
+   |     ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:23:5
+   |
+LL |     /// Bar
+   |     ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:25:5
+   |
+LL |     #[must_use]
+   |     ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:27:5
+   |
+LL |     /// Baz
+   |     ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:29:5
+   |
+LL |     #[no_mangle] b: i32,
+   |     ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:34:5
+   |
+LL |     /// Foo
+   |     ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:38:5
+   |
+LL |     /// Bar
+   |     ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:40:5
+   |
+LL |     #[must_use]
+   |     ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:42:5
+   |
+LL |     /// Baz
+   |     ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:44:5
+   |
+LL |     #[no_mangle] b: i32,
+   |     ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:51:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:54:9
+   |
+LL |         /// Bar
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:58:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:60:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:62:9
+   |
+LL |         /// Qux
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:64:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:69:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:73:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:75:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:77:9
+   |
+LL |         /// Qux
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:79:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:87:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:90:9
+   |
+LL |         /// Bar
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:94:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:96:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:98:9
+   |
+LL |         /// Qux
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:100:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:106:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:109:9
+   |
+LL |         /// Bar
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:113:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:115:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:117:9
+   |
+LL |         /// Qux
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:119:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:124:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:128:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:130:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:132:9
+   |
+LL |         /// Qux
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:134:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:141:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:144:9
+   |
+LL |         /// Bar
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:148:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:150:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:152:9
+   |
+LL |         /// Qux
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:154:9
+   |
+LL |         #[no_mangle] b: i32,
+   |         ^^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:161:9
+   |
+LL |         /// Foo
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:165:9
+   |
+LL |         /// Bar
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:167:9
+   |
+LL |         #[must_use]
+   |         ^^^^^^^^^^^
+
+error: documentation comments cannot be applied to function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:169:9
+   |
+LL |         /// Baz
+   |         ^^^^^^^ doc comments are not allowed here
+
+error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
+  --> $DIR/param-attrs-builtin-attrs.rs:171:9
+   |
+LL |         #[no_mangle] b: i32
+   |         ^^^^^^^^^^^^
+
+error: aborting due to 64 previous errors
+
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-cfg.rs b/tests/ui/rfc-2565-param-attrs/param-attrs-cfg.rs
new file mode 100644
index 00000000000..a4d9d32b514
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-cfg.rs
@@ -0,0 +1,121 @@
+// compile-flags: --cfg something
+// edition:2018
+
+#![feature(async_closure)]
+#![deny(unused_variables)]
+
+extern "C" {
+    fn ffi(
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        #[cfg_attr(something, cfg(nothing))] c: i32,
+        #[cfg_attr(nothing, cfg(nothing))] ...
+    );
+}
+
+type FnType = fn(
+    #[cfg(nothing)] a: i32,
+    #[cfg(something)] b: i32,
+    #[cfg_attr(nothing, cfg(nothing))] c: i32,
+    #[cfg_attr(something, cfg(nothing))] d: i32,
+);
+
+async fn foo_async(
+    #[cfg(something)] a: i32,
+    //~^ ERROR unused variable: `a`
+    #[cfg(nothing)] b: i32,
+) {}
+fn foo(
+    #[cfg(nothing)] a: i32,
+    #[cfg(something)] b: i32,
+    //~^ ERROR unused variable: `b`
+    #[cfg_attr(nothing, cfg(nothing))] c: i32,
+    //~^ ERROR unused variable: `c`
+    #[cfg_attr(something, cfg(nothing))] d: i32,
+) {}
+
+struct RefStruct {}
+impl RefStruct {
+    async fn bar_async(
+        &self,
+        #[cfg(something)] a: i32,
+        //~^ ERROR unused variable: `a`
+        #[cfg(nothing)] b: i32,
+    ) {}
+    fn bar(
+        &self,
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    ) {}
+    fn issue_64682_associated_fn(
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    ) {}
+}
+trait RefTrait {
+    fn bar(
+        &self,
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    ) {}
+    fn issue_64682_associated_fn(
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    ) {}
+}
+impl RefTrait for RefStruct {
+    fn bar(
+        &self,
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    ) {}
+    fn issue_64682_associated_fn(
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    ) {}
+}
+
+fn main() {
+    let _: unsafe extern "C" fn(_, ...) = ffi;
+    let _: fn(_, _) = foo;
+    let _: FnType = |_, _| {};
+    let a = async move |
+        #[cfg(something)] a: i32,
+        //~^ ERROR unused variable: `a`
+        #[cfg(nothing)] b: i32,
+    | {};
+    let c = |
+        #[cfg(nothing)] a: i32,
+        #[cfg(something)] b: i32,
+        //~^ ERROR unused variable: `b`
+        #[cfg_attr(nothing, cfg(nothing))] c: i32,
+        //~^ ERROR unused variable: `c`
+        #[cfg_attr(something, cfg(nothing))] d: i32,
+    | {};
+    let _ = a(1);
+    let _ = c(1, 2);
+}
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr b/tests/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr
new file mode 100644
index 00000000000..6d18d295cfc
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr
@@ -0,0 +1,122 @@
+error: unused variable: `a`
+  --> $DIR/param-attrs-cfg.rs:24:23
+   |
+LL |     #[cfg(something)] a: i32,
+   |                       ^ help: if this is intentional, prefix it with an underscore: `_a`
+   |
+note: the lint level is defined here
+  --> $DIR/param-attrs-cfg.rs:5:9
+   |
+LL | #![deny(unused_variables)]
+   |         ^^^^^^^^^^^^^^^^
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:30:23
+   |
+LL |     #[cfg(something)] b: i32,
+   |                       ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:32:40
+   |
+LL |     #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                        ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `a`
+  --> $DIR/param-attrs-cfg.rs:41:27
+   |
+LL |         #[cfg(something)] a: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_a`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:48:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:50:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:56:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:58:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:67:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:69:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:75:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:77:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:86:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:88:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:94:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:96:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: unused variable: `a`
+  --> $DIR/param-attrs-cfg.rs:107:27
+   |
+LL |         #[cfg(something)] a: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_a`
+
+error: unused variable: `b`
+  --> $DIR/param-attrs-cfg.rs:113:27
+   |
+LL |         #[cfg(something)] b: i32,
+   |                           ^ help: if this is intentional, prefix it with an underscore: `_b`
+
+error: unused variable: `c`
+  --> $DIR/param-attrs-cfg.rs:115:44
+   |
+LL |         #[cfg_attr(nothing, cfg(nothing))] c: i32,
+   |                                            ^ help: if this is intentional, prefix it with an underscore: `_c`
+
+error: aborting due to 19 previous errors
+
diff --git a/tests/ui/rfc-2565-param-attrs/param-attrs-pretty.rs b/tests/ui/rfc-2565-param-attrs/param-attrs-pretty.rs
new file mode 100644
index 00000000000..1183ac65b9a
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/param-attrs-pretty.rs
@@ -0,0 +1,61 @@
+// aux-build:param-attrs.rs
+
+// check-pass
+
+#![feature(c_variadic)]
+
+extern crate param_attrs;
+
+use param_attrs::*;
+
+struct W(u8);
+
+#[attr_extern]
+extern "C" { fn ffi(#[a1] arg1: i32, #[a2] ...); }
+
+#[attr_extern_cvar]
+unsafe extern "C" fn cvar(arg1: i32, #[a1] mut args: ...) {}
+
+#[attr_alias]
+type Alias = fn(#[a1] u8, #[a2] ...);
+
+#[attr_free]
+fn free(#[a1] arg1: u8) {
+    let lam = |#[a2] W(x), #[a3] y| ();
+}
+
+impl W {
+    #[attr_inherent_1]
+    fn inherent1(#[a1] self, #[a2] arg1: u8) {}
+
+    #[attr_inherent_2]
+    fn inherent2(#[a1] &self, #[a2] arg1: u8) {}
+
+    #[attr_inherent_3]
+    fn inherent3<'a>(#[a1] &'a mut self, #[a2] arg1: u8) {}
+
+    #[attr_inherent_4]
+    fn inherent4<'a>(#[a1] self: Box<Self>, #[a2] arg1: u8) {}
+
+    #[attr_inherent_issue_64682]
+    fn inherent5(#[a1] #[a2] arg1: u8, #[a3] arg2: u8) {}
+}
+
+trait A {
+    #[attr_trait_1]
+    fn trait1(#[a1] self, #[a2] arg1: u8);
+
+    #[attr_trait_2]
+    fn trait2(#[a1] &self, #[a2] arg1: u8);
+
+    #[attr_trait_3]
+    fn trait3<'a>(#[a1] &'a mut self, #[a2] arg1: u8);
+
+    #[attr_trait_4]
+    fn trait4<'a>(#[a1] self: Box<Self>, #[a2] arg1: u8, #[a3] Vec<u8>);
+
+    #[attr_trait_issue_64682]
+    fn trait5(#[a1] #[a2] arg1: u8, #[a3] arg2: u8);
+}
+
+fn main() {}
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 00000000000..54f2f451bbe
--- /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() {}
diff --git a/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr b/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr
new file mode 100644
index 00000000000..e74d05d49b8
--- /dev/null
+++ b/tests/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr
@@ -0,0 +1,176 @@
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:11:23
+   |
+LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
+   |                       ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:11:40
+   |
+LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
+   |                                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:15:40
+   |
+LL | unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
+   |                                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:18:30
+   |
+LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
+   |                              ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:18:40
+   |
+LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
+   |                                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:22:11
+   |
+LL | fn free(#[id] arg1: u8) {
+   |           ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:24:18
+   |
+LL |     let lam = |#[id] W(x), #[id] y: usize| ();
+   |                  ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:24:30
+   |
+LL |     let lam = |#[id] W(x), #[id] y: usize| ();
+   |                              ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:30:20
+   |
+LL |     fn inherent1(#[id] self, #[id] arg1: u8) {}
+   |                    ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:30:32
+   |
+LL |     fn inherent1(#[id] self, #[id] arg1: u8) {}
+   |                                ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:33:20
+   |
+LL |     fn inherent2(#[id] &self, #[id] arg1: u8) {}
+   |                    ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:33:33
+   |
+LL |     fn inherent2(#[id] &self, #[id] arg1: u8) {}
+   |                                 ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:36:24
+   |
+LL |     fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
+   |                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:36:44
+   |
+LL |     fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
+   |                                            ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:39:24
+   |
+LL |     fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
+   |                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:39:47
+   |
+LL |     fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
+   |                                               ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:42:40
+   |
+LL |     fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
+   |                                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:42:56
+   |
+LL |     fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {}
+   |                                                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:48:17
+   |
+LL |     fn trait1(#[id] self, #[id] arg1: u8);
+   |                 ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:48:29
+   |
+LL |     fn trait1(#[id] self, #[id] arg1: u8);
+   |                             ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:51:17
+   |
+LL |     fn trait2(#[id] &self, #[id] arg1: u8);
+   |                 ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:51:30
+   |
+LL |     fn trait2(#[id] &self, #[id] arg1: u8);
+   |                              ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:54:21
+   |
+LL |     fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
+   |                     ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:54:41
+   |
+LL |     fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
+   |                                         ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:57:21
+   |
+LL |     fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
+   |                     ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:57:44
+   |
+LL |     fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
+   |                                            ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:57:60
+   |
+LL |     fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
+   |                                                            ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:61:40
+   |
+LL |     fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
+   |                                        ^^ not a non-macro attribute
+
+error: expected non-macro attribute, found attribute macro `id`
+  --> $DIR/proc-macro-cannot-be-used.rs:61:56
+   |
+LL |     fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8);
+   |                                                        ^^ not a non-macro attribute
+
+error: aborting due to 29 previous errors
+