error[E0308]: mismatched types --> $DIR/illegal-upcast-from-impl.rs:16:66 | LL | fn illegal(x: &dyn Sub) -> &dyn Super { x } | ----------------------- ^ expected trait `Super`, found trait `Sub` | | | expected `&dyn Super` because of return type | = note: expected reference `&dyn Super` found reference `&dyn Sub` error: aborting due to previous error For more information about this error, try `rustc --explain E0308`.