1 error[E0746]: return type cannot have an unboxed trait object
4 LL | fn foo() -> dyn Trait { Struct }
5 | ^^^^^^^^^ doesn't have a size known at compile-time
7 = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
8 help: use `impl Trait` as the return type, as all return paths are of type `Struct`, which implements `Trait`
10 LL | fn foo() -> impl Trait { Struct }
13 error[E0746]: return type cannot have an unboxed trait object
14 --> $DIR/E0746.rs:11:13
16 LL | fn bar() -> dyn Trait {
17 | ^^^^^^^^^ doesn't have a size known at compile-time
19 = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
20 help: use `impl Trait` as the return type, as all return paths are of type `{integer}`, which implements `Trait`
22 LL | fn bar() -> impl Trait {
25 error: aborting due to 2 previous errors
27 For more information about this error, try `rustc --explain E0746`.