rust/tests/ui/cast/ptr-to-trait-obj-different-args.stderr
2024-07-05 22:35:14 +02:00

54 lines
1.9 KiB
Plaintext

error[E0606]: casting `*const dyn A` as `*const dyn B` is invalid
--> $DIR/ptr-to-trait-obj-different-args.rs:18:27
|
LL | let b: *const dyn B = a as _;
| ^^^^^^
|
= note: vtable kinds may not match
error[E0308]: mismatched types
--> $DIR/ptr-to-trait-obj-different-args.rs:21:34
|
LL | let y: *const dyn Trait<Y> = x as _;
| ^^^^^^ expected `X`, found `Y`
|
= note: expected trait object `dyn Trait<X>`
found trait object `dyn Trait<Y>`
error[E0308]: mismatched types
--> $DIR/ptr-to-trait-obj-different-args.rs:27:34
|
LL | fn generic<T>(x: *const dyn Trait<X>, t: *const dyn Trait<T>) {
| - found this type parameter
LL | let _: *const dyn Trait<T> = x as _;
| ^^^^^^ expected `X`, found type parameter `T`
|
= note: expected trait object `dyn Trait<X>`
found trait object `dyn Trait<T>`
error[E0308]: mismatched types
--> $DIR/ptr-to-trait-obj-different-args.rs:28:34
|
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 _;
LL | let _: *const dyn Trait<X> = t as _;
| ^^^^^^ expected type parameter `T`, found `X`
|
= note: expected trait object `dyn Trait<T>`
found trait object `dyn Trait<X>`
error[E0308]: mismatched types
--> $DIR/ptr-to-trait-obj-different-args.rs:36:5
|
LL | x as _
| ^^^^^^ expected `u8`, found `u32`
|
= note: expected trait object `dyn Assocked<Assoc = u8>`
found trait object `dyn Assocked<Assoc = u32>`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0308, E0606.
For more information about an error, try `rustc --explain E0308`.