@@ -315,8 +315,8 @@ fn foo(#[inline] bar: u32) { .. }
315
315
Let ` OuterAttr ` denote the production for an attribute ` #[...] ` .
316
316
317
317
On the formal parameters of an ` fn ` item, including on method receivers,
318
- and irrespective of whether the ` fn ` has a body or not, ` OuterAttr+ ` is allowed.
319
- For example, all the following are valid:
318
+ and irrespective of whether the ` fn ` has a body or not, ` OuterAttr+ ` is allowed
319
+ but not required. For example, all the following are valid:
320
320
321
321
``` rust
322
322
fn g1 (#[attr1 ] #[attr2 ] pat : Type ) { .. }
@@ -334,11 +334,17 @@ fn g6<'a>(#[attr] &'a self) { .. }
334
334
fn g7 <'a >(#[attr ] & 'a mut self ) { .. }
335
335
336
336
fn g8 (#[attr ] self : Self ) { .. }
337
+
338
+ fn g9 (#[attr ] self : Rc <Self >) { .. }
337
339
```
338
340
339
341
The attributes here apply to the parameter * as a whole* ,
340
342
e.g. in ` g2 ` , ` #[attr] ` applies to ` pat: Type ` as opposed to ` pat ` .
341
343
344
+ More generally, an ` fn ` item contains a list of formal parameters separated or
345
+ terminated by ` , ` and delimited by ` ( ` and ` ) ` . Each parameter in that list may
346
+ optionally be prefixed by ` OuterAttr+ ` .
347
+
342
348
### Variadics
343
349
344
350
Attributes may also be attached to ` ... ` on variadic functions, e.g.
@@ -349,6 +355,8 @@ extern "C" {
349
355
}
350
356
```
351
357
358
+ That is, for the purposes of this RFC, ` ... ` is considered as a parameter.
359
+
352
360
### Anonymous parameters in Rust 2015
353
361
354
362
In Rust 2015 edition, as ` fn ` s may have anonymous parameters, e.g.
0 commit comments