]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0746.stderr
Suggest `if let`/`let_else` for refutable pat in `let`
[rust.git] / src / test / ui / error-codes / E0746.stderr
1 error[E0746]: return type cannot have an unboxed trait object
2   --> $DIR/E0746.rs:8:13
3    |
4 LL | fn foo() -> dyn Trait { Struct }
5    |             ^^^^^^^^^ doesn't have a size known at compile-time
6    |
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`
9    |
10 LL | fn foo() -> impl Trait { Struct }
11    |             ~~~~~~~~~~
12
13 error[E0746]: return type cannot have an unboxed trait object
14   --> $DIR/E0746.rs:11:13
15    |
16 LL | fn bar() -> dyn Trait {
17    |             ^^^^^^^^^ doesn't have a size known at compile-time
18    |
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`
21    |
22 LL | fn bar() -> impl Trait {
23    |             ~~~~~~~~~~
24
25 error: aborting due to 2 previous errors
26
27 For more information about this error, try `rustc --explain E0746`.