Files
rust/tests/ui/c-variadic/not-dyn-compatible.stderr
Folkert de Vries 01e83adc88 c-variadic: allow trait methods to be c-variadic
but a C-variadic method makes a trait dyn-incompatible. That is because
methods from dyn traits, when cast to a function pointer, create a shim.
That shim can't really forward the c-variadic arguments.
2025-09-11 10:27:28 +02:00

22 lines
956 B
Plaintext

error[E0038]: the trait `Trait` is not dyn compatible
--> $DIR/not-dyn-compatible.rs:27:30
|
LL | let dyn_object: &dyn Trait = &Struct(64);
| ^^^^^ `Trait` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> $DIR/not-dyn-compatible.rs:14:26
|
LL | trait Trait {
| ----- this trait is not dyn compatible...
...
LL | unsafe extern "C" fn dyn_method_ref(&self, mut ap: ...) -> u64 {
| ^^^^^^^^^^^^^^ ...because method `dyn_method_ref` is C-variadic
= help: consider moving `dyn_method_ref` to another trait
= help: only type `Struct` implements `Trait`; consider using it directly instead.
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0038`.