You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions with a self parameter may only appear as an [associated function] in a [trait] or [implementation].
84
84
85
85
r[items.fn.params.varargs]
86
-
A parameter with the `...` token indicates a [c-variadic function]. The variadic parameter may have an optional identifier, such as `args: ...`.
86
+
A parameter with the `...` token indicates a [c-variadic function], and may only be used as the last parameter. In an [`extern` block] the c-variadic parameter may have an optional identifier, such as `args: ...`, in a [c-variadic function definition] the identifier is mandatory.
87
87
88
88
r[items.fn.body]
89
89
## Function body
@@ -340,43 +340,37 @@ A *c-variadic* function accepts a variable argument list `pat: ...` as its final
340
340
341
341
```rust
342
342
unsafeextern"C"fnexample(ap:...) ->f64 {
343
-
unsafe { ap.arg::<f64>() }
343
+
unsafe { ap.next_arg::<f64>() }
344
344
}
345
345
```
346
346
347
347
This parameter stands in for an arbitrary number of arguments that may be passed by the caller.
348
348
349
349
> [!WARNING]
350
-
> Passing an unexpected number of arguments or arguments of unexpected type to a variadic function may lead to [undefined behavior][undefined].
350
+
> Passing an unexpected number of arguments or arguments of unexpected type to a c-variadic function may lead to [undefined behavior][undefined].
351
351
352
-
r[items.fn.c-variadic.variadic-parameter-type]
352
+
r[items.fn.c-variadic.c-variadic-parameter-type]
353
353
The type of `pat` in the function body is [`VaList`].
354
354
355
355
r[items.fn.c-variadic.desugar-brief]
356
356
A c-variadic function definition is roughly equivalent to a function operating on a [`VaList`].
0 commit comments