diff --git a/src/expressions/closure-expr.md b/src/expressions/closure-expr.md
index aa9299bd6..feb74a508 100644
--- a/src/expressions/closure-expr.md
+++ b/src/expressions/closure-expr.md
@@ -10,7 +10,7 @@
> _ClosureParam_ (`,` _ClosureParam_)\* `,`?
>
> _ClosureParam_ :\
-> [_Pattern_] ( `:` [_Type_] )?
+> [_OuterAttribute_]\* [_Pattern_] ( `:` [_Type_] )?
A _closure expression_ defines a closure and denotes it as a value, in a single
expression. A closure expression is a pipe-symbol-delimited (`|`) list of
@@ -67,12 +67,19 @@ let word = "konnichiwa".to_owned();
ten_times(move |j| println!("{}, {}", word, j));
```
+## Attributes on closure parameters
+
+Attributes on closure parameters follow the same rules and restrictions as
+[regular function parameters].
+
[block]: block-expr.md
[function definitions]: ../items/functions.md
[patterns]: ../patterns.md
+[regular function parameters]: ../items/functions.md#attributes-on-function-parameters
[_Expression_]: ../expressions.md
[_BlockExpression_]: block-expr.md
+[_OuterAttribute_]: ../attributes.md
[_TypeNoBounds_]: ../types.md#type-expressions
[_Pattern_]: ../patterns.md
[_Type_]: ../types.md#type-expressions
diff --git a/src/items/associated-items.md b/src/items/associated-items.md
index 29ea6da9b..83259aeaf 100644
--- a/src/items/associated-items.md
+++ b/src/items/associated-items.md
@@ -86,8 +86,13 @@ let _: f64 = f64::from_i32(42);
> [_BlockExpression_]
>
> _SelfParam_ :\
-> (`&` | `&` [_Lifetime_])? `mut`? `self`\
-> | `mut`? `self` (`:` [_Type_])?
+> [_OuterAttribute_]\* ( _ShorthandSelf_ | _TypedSelf_ )
+>
+> _ShorthandSelf_ :\
+> (`&` | `&` [_Lifetime_])? `mut`? `self`
+>
+> _TypedSelf_ :\
+> `mut`? `self` `:` [_Type_]
Associated functions whose first parameter is named `self` are called *methods*
and may be invoked using the [method call operator], for example, `x.foo()`, as
@@ -190,6 +195,11 @@ let bounding_box = circle_shape.bounding_box();
> methods with anonymous parameters (e.g. `fn foo(u8)`). This is deprecated and
> an error as of the 2018 edition. All parameters must have an argument name.
+#### Attributes on method parameters
+
+Attributes on method parameters follow the same rules and restrictions as
+[regular function parameters].
+
## Associated Types
*Associated types* are [type aliases] associated with another type. Associated
@@ -330,6 +340,7 @@ fn main() {
[_FunctionReturnType_]: functions.md
[_Generics_]: generics.md
[_Lifetime_]: ../trait-bounds.md
+[_OuterAttribute_]: ../attributes.md
[_Type_]: ../types.md#type-expressions
[_WhereClause_]: generics.md#where-clauses
[`Arc`]: ../special-types-and-traits.md#arct
@@ -349,3 +360,4 @@ fn main() {
[function item]: ../types/function-item.md
[method call operator]: ../expressions/method-call-expr.md
[path]: ../paths.md
+[regular function parameters]: functions.md#attributes-on-function-parameters
diff --git a/src/items/external-blocks.md b/src/items/external-blocks.md
index f3e692ac9..e4e67b3c3 100644
--- a/src/items/external-blocks.md
+++ b/src/items/external-blocks.md
@@ -24,14 +24,14 @@
> _NamedFunctionParam_ ( `,` _NamedFunctionParam_ )\* `,`?
>
> _NamedFunctionParam_ :\
-> ( [IDENTIFIER] | `_` ) `:` [_Type_]
+> [_OuterAttribute_]\* ( [IDENTIFIER] | `_` ) `:` [_Type_]
>
> _NamedFunctionParametersWithVariadics_ :\
-> ( _NamedFunctionParam_ `,` )\* _NamedFunctionParam_ `,` `...`
+> ( _NamedFunctionParam_ `,` )\* _NamedFunctionParam_ `,` [_OuterAttribute_]\* `...`
External blocks provide _declarations_ of items that are not _defined_ in the
current crate and are the basis of Rust's foreign function interface. These are
-akin to unchecked imports.
+akin to unchecked imports.
Two kind of item _declarations_ are allowed in external blocks: [functions] and
[statics]. Calling functions or accessing statics that are declared in external
@@ -162,6 +162,11 @@ extern {
}
```
+### Attributes on function parameters
+
+Attributes on extern function parameters follow the same rules and
+restrictions as [regular function parameters].
+
[IDENTIFIER]: ../identifiers.md
[WebAssembly module]: https://webassembly.github.io/spec/core/syntax/modules.html
[functions]: functions.md
@@ -177,3 +182,4 @@ extern {
[_Visibility_]: ../visibility-and-privacy.md
[_WhereClause_]: generics.md#where-clauses
[attributes]: ../attributes.md
+[regular function parameters]: functions.md#attributes-on-function-parameters
diff --git a/src/items/functions.md b/src/items/functions.md
index 63f436fe4..bd99c93e1 100644
--- a/src/items/functions.md
+++ b/src/items/functions.md
@@ -20,7 +20,7 @@
> _FunctionParam_ (`,` _FunctionParam_)\* `,`?
>
> _FunctionParam_ :\
-> [_Pattern_] `:` [_Type_]
+> [_OuterAttribute_]\* [_Pattern_] `:` [_Type_]
>
> _FunctionReturnType_ :\
> `->` [_Type_]
@@ -345,17 +345,23 @@ fn test_only() {
> Note: Except for lints, it is idiomatic to only use outer attributes on
> function items.
-The attributes that have meaning on a function are [`cfg`], [`deprecated`],
+The attributes that have meaning on a function are [`cfg`], [`cfg_attr`], [`deprecated`],
[`doc`], [`export_name`], [`link_section`], [`no_mangle`], [the lint check
attributes], [`must_use`], [the procedural macro attributes], [the testing
attributes], and [the optimization hint attributes]. Functions also accept
attributes macros.
+### Attributes on function parameters
+
+The only attributes allowed on function parameters are [`cfg`], [`cfg_attr`],
+and [the lint check attributes].
+
[IDENTIFIER]: ../identifiers.md
[RAW_STRING_LITERAL]: ../tokens.md#raw-string-literals
[STRING_LITERAL]: ../tokens.md#string-literals
[_BlockExpression_]: ../expressions/block-expr.md
[_Generics_]: generics.md
+[_OuterAttribute_]: ../attributes.md
[_Pattern_]: ../patterns.md
[_Type_]: ../types.md#type-expressions
[_WhereClause_]: generics.md#where-clauses
@@ -368,7 +374,8 @@ attributes macros.
[*function item type*]: ../types/function-item.md
[Trait]: traits.md
[attributes]: ../attributes.md
-[`cfg`]: ../conditional-compilation.md
+[`cfg`]: ../conditional-compilation.md#the-cfg-attribute
+[`cfg_attr`]: ../conditional-compilation.md#the-cfg_attr-attribute
[the lint check attributes]: ../attributes/diagnostics.md#lint-check-attributes
[the procedural macro attributes]: ../procedural-macros.md
[the testing attributes]: ../attributes/testing.md
diff --git a/src/items/traits.md b/src/items/traits.md
index e835a6097..dea8ecad0 100644
--- a/src/items/traits.md
+++ b/src/items/traits.md
@@ -38,7 +38,7 @@
> _TraitFunctionParam_ (`,` _TraitFunctionParam_)\* `,`?
>
> _TraitFunctionParam_[†](#parameter-patterns) :\
-> ( [_Pattern_] `:` )? [_Type_]
+> [_OuterAttribute_]\* ( [_Pattern_] `:` )? [_Type_]
>
> _TraitConst_ :\
> `const` [IDENTIFIER] `:` [_Type_] ( `=` [_Expression_] )? `;`
diff --git a/src/types/function-pointer.md b/src/types/function-pointer.md
index 88ef50c24..f08a04c0e 100644
--- a/src/types/function-pointer.md
+++ b/src/types/function-pointer.md
@@ -15,10 +15,10 @@
> _MaybeNamedParam_ ( `,` _MaybeNamedParam_ )\* `,`?
>
> _MaybeNamedParam_ :\
-> ( ( [IDENTIFIER] | `_` ) `:` )? [_Type_]
+> [_OuterAttribute_]\* ( ( [IDENTIFIER] | `_` ) `:` )? [_Type_]
>
> _MaybeNamedFunctionParametersVariadic_ :\
-> ( _MaybeNamedParam_ `,` )\* _MaybeNamedParam_ `,` `...`
+> ( _MaybeNamedParam_ `,` )\* _MaybeNamedParam_ `,` [_OuterAttribute_]\* `...`
Function pointer types, written using the `fn` keyword, refer to a function
whose identity is not necessarily known at compile-time. They can be created
@@ -44,6 +44,11 @@ let bo: Binop = add;
x = bo(5,7);
```
+## Attributes on function pointer parameters
+
+Attributes on function pointer parameters follow the same rules and
+restrictions as [regular function parameters].
+
[IDENTIFIER]: ../identifiers.md
[_ForLifetimes_]: ../items/generics.md#where-clauses
[_FunctionQualifiers_]: ../items/functions.md
@@ -53,4 +58,5 @@ x = bo(5,7);
[closures]: closure.md
[extern function]: ../items/functions.md#extern-function-qualifier
[function items]: function-item.md
+[regular function parameters]: ../items/functions.md#attributes-on-function-parameters
[unsafe function]: ../unsafe-functions.md