trait Super {} trait Sub: Super {} struct Wrapper(T); // This cast should not compile. // Upcasting can't work here, because we are also changing the type (`Wrapper`), // and reinterpreting would be confusing/surprising. // See fn cast(ptr: *const dyn Sub) -> *const Wrapper { ptr as _ //~ error: casting `*const (dyn Sub + 'static)` as `*const Wrapper` is invalid } fn main() {}