Skip to content

Commit 7fdaa3f

Browse files
committed
Fix grammar pertaining to C variadics in function pointer types
The grammar was incorrect since * C variadics `...` no longer need to be preceded by a normal parameter * that's the case since <rust-lang/rust#124048> * C variadics don't need to be the final element, `fn(..., i32)` is perfectly fine * C variadics can indeed be named (e.g., `fn f(_: ...)` or `fn(v: ...)`) * C variadics can be followed by a comma (e.g., `fn(...,)`)
1 parent b6bc1cd commit 7fdaa3f

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/types/function-pointer.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,17 @@ r[type.fn-pointer.syntax]
55
```grammar,types
66
BareFunctionType ->
77
ForLifetimes? FunctionTypeQualifiers `fn`
8-
`(` FunctionParametersMaybeNamedVariadic? `)` BareFunctionReturnType?
8+
`(` MaybeNamedFunctionParameters? `)` BareFunctionReturnType?
99
1010
FunctionTypeQualifiers -> Safety? (`extern` Abi?)?
1111
1212
BareFunctionReturnType -> `->` TypeNoBounds
1313
14-
FunctionParametersMaybeNamedVariadic ->
15-
MaybeNamedFunctionParameters | MaybeNamedFunctionParametersVariadic
16-
1714
MaybeNamedFunctionParameters ->
1815
MaybeNamedParam ( `,` MaybeNamedParam )* `,`?
1916
2017
MaybeNamedParam ->
21-
OuterAttribute* ( ( IDENTIFIER | `_` ) `:` )? Type
22-
23-
MaybeNamedFunctionParametersVariadic ->
24-
( MaybeNamedParam `,` )* MaybeNamedParam `,` OuterAttribute* `...`
18+
OuterAttribute* ( ( IDENTIFIER | `_` ) `:` )? ( Type | `...` )
2519
```
2620

2721
r[type.fn-pointer.intro]

0 commit comments

Comments
 (0)