1
Fork 0
rust/tests/ui/cast/ptr-to-trait-obj-wrap.stderr
Waffle Lapkin 5712d2e956
add a test for pointer casts involving un/re/wrapping trait objects
the errors should not be there, this is a bug/missing feature.
2025-03-08 14:49:47 +01:00

57 lines
2.1 KiB
Text

error[E0277]: the trait bound `W<(dyn A + 'static)>: A` is not satisfied
--> $DIR/ptr-to-trait-obj-wrap.rs:13:5
|
LL | a as _
| ^ the trait `A` is not implemented for `W<(dyn A + 'static)>`
|
help: this trait has no implementations, consider adding one
--> $DIR/ptr-to-trait-obj-wrap.rs:7:1
|
LL | trait A {}
| ^^^^^^^
= note: required for the cast from `*const W<(dyn A + 'static)>` to `*const dyn A`
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
--> $DIR/ptr-to-trait-obj-wrap.rs:13:5
|
LL | a as _
| ^ doesn't have a size known at compile-time
|
= help: within `W<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)`
note: required because it appears within the type `W<(dyn A + 'static)>`
--> $DIR/ptr-to-trait-obj-wrap.rs:9:8
|
LL | struct W<T: ?Sized>(T);
| ^
= note: required for the cast from `*const W<(dyn A + 'static)>` to `*const dyn A`
error[E0277]: the trait bound `W<(dyn A + 'static)>: A` is not satisfied
--> $DIR/ptr-to-trait-obj-wrap.rs:19:5
|
LL | a as _
| ^ the trait `A` is not implemented for `W<(dyn A + 'static)>`
|
help: this trait has no implementations, consider adding one
--> $DIR/ptr-to-trait-obj-wrap.rs:7:1
|
LL | trait A {}
| ^^^^^^^
= note: required for the cast from `*const W<W<(dyn A + 'static)>>` to `*const W<dyn A>`
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
--> $DIR/ptr-to-trait-obj-wrap.rs:19:5
|
LL | a as _
| ^ doesn't have a size known at compile-time
|
= help: within `W<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)`
note: required because it appears within the type `W<(dyn A + 'static)>`
--> $DIR/ptr-to-trait-obj-wrap.rs:9:8
|
LL | struct W<T: ?Sized>(T);
| ^
= note: required for the cast from `*const W<W<(dyn A + 'static)>>` to `*const W<dyn A>`
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.