error[E0308]: mismatched types --> $DIR/return-dyn-type-mismatch-2.rs:7:5 | LL | fn foo() -> dyn Trait | ------------ expected `(dyn Trait + 'static)` because of return type ... LL | 42 | ^^ expected `dyn Trait`, found integer | = note: expected trait object `(dyn Trait + 'static)` found type `{integer}` error: aborting due to previous error For more information about this error, try `rustc --explain E0308`.