Rust errors / Types and traits
Rust compiler error · checked with rustc 1.99.0
Rust error E0743: C-variadic type `...` may not be nested inside another type
What it meansThe C-variadic type ... has been nested inside another type.
What rustc prints
error[E0743]: C-variadic type `...` may not be nested inside another type
--> main.rs:1:20
|
1 | fn foo2(x: u8, y: &...) {} // error!
| ^^^Real output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
The C-variadic type ... has been nested inside another type.
Erroneous code example:
fn foo2(x: u8, y: &...) {} // error!
Only foreign functions can use the C-variadic type (...). In such functions, ... may only occur non-nested. That is, y: &'a ... is not allowed.
A C-variadic type is used to give an undefined number of parameters to a given function (like printf in C). The equivalent in Rust would be to use macros directly (like println! for example).
From rustc --explain E0743 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0308mismatched types
- E0277the trait bound is not satisfied
- E0599no method named X found in the current scope
- E0433failed to resolve
- E0740field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
- E0741`A` must implement `ConstParamTy` to be used as the type of a const generic parameter
- E0746return type cannot have an unboxed trait object
- E0749negative impls cannot have any items
Up next
Often hit nextE0308: mismatched typesA related error from the same family.Read it next →Did this answer your question?