Skip to main content

rewrite_variadic_dots

Function rewrite_variadic_dots 

Source
pub(crate) fn rewrite_variadic_dots(sig: &mut Signature) -> Result<()>
Expand description

Replace Rust variadic syntax (name: ... / _: ...) with a trailing &miniextendr_api::dots::Dots parameter, so downstream codegen never emits a non-extern variadic Rust fn. Named dots keep the user’s identifier; _: ... binds __miniextendr_dots.

A bare ... binds __miniextendr_dots too, but rustc rejects it before the macro runs (the deny-by-default varargs_without_pattern lint, rust-lang/rust#145544) unless the crate allows that lint, and its fix is _: ... (#1743).

syn parses the variadic only in last position, so a formal after the dots is spelled with an explicit rest: &Dots parameter instead. A signature with both is an error: a function takes at most one ....