rust/tests/ui/cast/ptr-to-trait-obj-different-args.stderr

44 lines
1.5 KiB
Plaintext
Raw Normal View History

error[E0606]: casting `*const dyn A` as `*const dyn B` is invalid
2024-06-04 08:21:09 -05:00
--> $DIR/ptr-to-trait-obj-different-args.rs:18:27
|
LL | let b: *const dyn B = a as _;
| ^^^^^^
|
= note: the trait objects may have different vtables
error[E0606]: casting `*const dyn Trait<X>` as `*const dyn Trait<Y>` is invalid
2024-06-04 08:21:09 -05:00
--> $DIR/ptr-to-trait-obj-different-args.rs:21:34
|
LL | let y: *const dyn Trait<Y> = x as _;
| ^^^^^^
|
= note: the trait objects may have different vtables
error[E0606]: casting `*const (dyn Trait<X> + 'static)` as `*const dyn Trait<T>` is invalid
2024-06-04 08:21:09 -05:00
--> $DIR/ptr-to-trait-obj-different-args.rs:27:34
|
LL | let _: *const dyn Trait<T> = x as _;
| ^^^^^^
|
= note: the trait objects may have different vtables
error[E0606]: casting `*const (dyn Trait<T> + 'static)` as `*const dyn Trait<X>` is invalid
2024-06-04 08:21:09 -05:00
--> $DIR/ptr-to-trait-obj-different-args.rs:28:34
|
LL | let _: *const dyn Trait<X> = t as _;
| ^^^^^^
|
= note: the trait objects may have different vtables
error[E0606]: casting `*mut (dyn Assocked<Assoc = u8> + 'static)` as `*mut (dyn Assocked<Assoc = u32> + 'static)` is invalid
2024-06-04 08:21:09 -05:00
--> $DIR/ptr-to-trait-obj-different-args.rs:36:5
|
LL | x as _
| ^^^^^^
|
= note: the trait objects may have different vtables
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0606`.