@@ -421,12 +421,22 @@ All function items implement [`Fn`], [`FnMut`], [`FnOnce`], [`Copy`],
421
421
> ** <sup >Syntax</sup >** \
422
422
> _ BareFunctionType_ :\
423
423
>   ;  ; [ _ ForLifetimes_ ] <sup >?</sup > [ _ FunctionFront_ ] ` fn ` \
424
- >   ;  ;   ;  ; ` ( ` [ _ FunctionParametersMaybeNamedVariadic_ ] <sup >?</sup > ` ) ` _ BareFunctionReturnType_ <sup >?</sup >
424
+ >   ;  ;   ;  ; ` ( ` _ FunctionParametersMaybeNamedVariadic_ <sup >?</sup > ` ) ` _ BareFunctionReturnType_ <sup >?</sup >
425
425
>
426
426
> _ BareFunctionReturnType_ :\
427
427
>   ;  ; ` -> ` [ _ TypeNoBounds_ ]
428
-
429
- <!-- TODO: _FunctionParametersMaybeNamedVariadic_ -->
428
+ >
429
+ > _ FunctionParametersMaybeNamedVariadic_ :\
430
+ >   ;  ; _ MaybeNamedFunctionParameters_ | _ MaybeNamedFunctionParametersVariadic_
431
+ >
432
+ > _ MaybeNamedFunctionParameters_ :\
433
+ >   ;  ; _ MaybeNamedParam_ ( ` , ` _ MaybeNamedParam_ )<sup >\* </sup > ` , ` <sup >?</sup >
434
+ >
435
+ > _ MaybeNamedParam_ :\
436
+ >   ;  ; ( ( [ IDENTIFIER] | ` _ ` ) ` : ` )<sup >?</sup > [ _ Type_ ]
437
+ >
438
+ > _ MaybeNamedFunctionParametersVariadic_ :\
439
+ >   ;  ; ( _ MaybeNamedParam_ ` , ` )<sup >\* </sup > _ MaybeNamedParam_ ` , ` ` ... `
430
440
431
441
Function pointer types, written using the ` fn ` keyword, refer to a function
432
442
whose identity is not necessarily known at compile-time. They can be created
@@ -437,6 +447,9 @@ A function pointer type consists of a possibly-empty set of function-type
437
447
modifiers (such as ` unsafe ` or ` extern ` ), a sequence of input types and an
438
448
output type.
439
449
450
+ Variadic parameters can only be specified with [ ` extern ` ] function types with
451
+ the ` "C" ` or ` "cdecl" ` calling convention.
452
+
440
453
An example where ` Binop ` is defined as a function pointer type:
441
454
442
455
``` rust
@@ -825,6 +838,7 @@ impl Printable for String {
825
838
826
839
> Note: The notation ` &self ` is a shorthand for ` self: &Self ` .
827
840
841
+ [ IDENTIFIER ] : identifiers.html
828
842
[ _ArrayType_ ] : #array-and-slice-types
829
843
[ _BareFunctionType_ ] : #function-pointer-types
830
844
[ _Expression_ ] : expressions.html
@@ -854,6 +868,7 @@ impl Printable for String {
854
868
[ `Send` ] : special-types-and-traits.html#send
855
869
[ `Sync` ] : special-types-and-traits.html#sync
856
870
[ `Sized` ] : special-types-and-traits.html#sized
871
+ [ `extern` ] : items/external-blocks.html
857
872
[ derive ] : attributes.html#derive
858
873
[ `Vec<T>` ] : ../std/vec/struct.Vec.html
859
874
[ dynamically sized type ] : dynamically-sized-types.html
0 commit comments