2024-06-04 15:47:16 +02:00
error[E0606]: casting `*const dyn A` as `*const dyn B` is invalid
2024-06-04 15:21:09 +02:00
--> $DIR/ptr-to-trait-obj-different-args.rs:18:27
2024-01-22 17:21:57 +00:00
|
LL | let b: *const dyn B = a as _;
2024-06-04 15:47:16 +02:00
| ^^^^^^
2024-01-22 17:21:57 +00:00
|
2024-06-04 15:47:16 +02:00
= note: vtable kinds may not match
2024-01-22 17:21:57 +00:00
2024-07-05 22:35:14 +02:00
error[E0308]: mismatched types
2024-06-04 15:21:09 +02:00
--> $DIR/ptr-to-trait-obj-different-args.rs:21:34
2024-01-22 17:22:09 +00:00
|
LL | let y: *const dyn Trait<Y> = x as _;
2024-07-05 22:35:14 +02:00
| ^^^^^^ expected `X`, found `Y`
2024-01-22 17:22:09 +00:00
|
2024-07-05 22:35:14 +02:00
= note: expected trait object `dyn Trait<X>`
found trait object `dyn Trait<Y>`
2024-08-13 09:33:12 -07:00
= help: `dyn Trait<Y>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well
2024-01-22 17:22:09 +00:00
2024-07-05 22:35:14 +02:00
error[E0308]: mismatched types
2024-06-04 15:21:09 +02:00
--> $DIR/ptr-to-trait-obj-different-args.rs:27:34
2024-01-22 17:22:09 +00:00
|
2024-07-05 22:35:14 +02:00
LL | fn generic<T>(x: *const dyn Trait<X>, t: *const dyn Trait<T>) {
| - found this type parameter
2024-01-22 17:22:09 +00:00
LL | let _: *const dyn Trait<T> = x as _;
2024-07-05 22:35:14 +02:00
| ^^^^^^ expected `X`, found type parameter `T`
2024-01-22 17:22:09 +00:00
|
2024-07-05 22:35:14 +02:00
= note: expected trait object `dyn Trait<X>`
found trait object `dyn Trait<T>`
2024-08-13 09:33:12 -07:00
= help: `dyn Trait<T>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well
2024-01-22 17:22:09 +00:00
2024-07-05 22:35:14 +02:00
error[E0308]: mismatched types
2024-06-04 15:21:09 +02:00
--> $DIR/ptr-to-trait-obj-different-args.rs:28:34
2024-01-22 17:22:09 +00:00
|
2024-07-05 22:35:14 +02:00
LL | fn generic<T>(x: *const dyn Trait<X>, t: *const dyn Trait<T>) {
| - expected this type parameter
LL | let _: *const dyn Trait<T> = x as _;
2024-01-22 17:22:09 +00:00
LL | let _: *const dyn Trait<X> = t as _;
2024-07-05 22:35:14 +02:00
| ^^^^^^ expected type parameter `T`, found `X`
2024-02-12 21:24:48 +00:00
|
2024-07-05 22:35:14 +02:00
= note: expected trait object `dyn Trait<T>`
found trait object `dyn Trait<X>`
2024-08-13 09:33:12 -07:00
= help: `dyn Trait<X>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well
2024-02-12 21:24:48 +00:00
2024-07-05 22:35:14 +02:00
error[E0308]: mismatched types
2024-06-04 15:21:09 +02:00
--> $DIR/ptr-to-trait-obj-different-args.rs:36:5
2024-02-12 21:24:48 +00:00
|
LL | x as _
2024-07-05 22:35:14 +02:00
| ^^^^^^ expected `u8`, found `u32`
2024-01-22 17:22:09 +00:00
|
2024-07-05 22:35:14 +02:00
= note: expected trait object `dyn Assocked<Assoc = u8>`
found trait object `dyn Assocked<Assoc = u32>`
2024-01-22 17:22:09 +00:00
2024-02-12 21:24:48 +00:00
error: aborting due to 5 previous errors
2024-01-22 17:21:57 +00:00
2024-07-05 22:35:14 +02:00
Some errors have detailed explanations: E0308, E0606.
For more information about an error, try `rustc --explain E0308`.