fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.1 KiB27 linesraw
1error[E0746]: return type cannot have an unboxed trait object
2  --> $DIR/E0746.rs:8:13
3   |
4LL | 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>
8help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait`
9   |
10LL | fn foo() -> impl Trait { Struct }
11   |             ^^^^^^^^^^
12
13error[E0746]: return type cannot have an unboxed trait object
14  --> $DIR/E0746.rs:11:13
15   |
16LL | 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>
20help: return `impl Trait` instead, as all return paths are of type `{integer}`, which implements `Trait`
21   |
22LL | fn bar() -> impl Trait {
23   |             ^^^^^^^^^^
24
25error: aborting due to 2 previous errors
26
27For more information about this error, try `rustc --explain E0746`.