@@ -6,13 +6,47 @@ LL | fn foo(x: dyn Foo) {
66 |
77 = help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
88 = help: unsized fn params are gated as an unstable feature
9+ help: you can use `impl Trait` as the argument type
10+ |
11+ LL | fn foo(x: impl Foo) {
12+ | ~~~~
913help: function arguments must have a statically known size, borrowed types always have a known size
1014 |
1115LL | fn foo(x: &dyn Foo) {
1216 | +
1317
1418error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
15- --> $DIR/feature-gate-unsized_fn_params.rs:24:9
19+ --> $DIR/feature-gate-unsized_fn_params.rs:21:8
20+ |
21+ LL | fn bar(x: Foo) {
22+ | ^ doesn't have a size known at compile-time
23+ |
24+ = help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
25+ = help: unsized fn params are gated as an unstable feature
26+ help: you can use `impl Trait` as the argument type
27+ |
28+ LL | fn bar(x: impl Foo) {
29+ | ++++
30+ help: function arguments must have a statically known size, borrowed types always have a known size
31+ |
32+ LL | fn bar(x: &Foo) {
33+ | +
34+
35+ error[E0277]: the size for values of type `[()]` cannot be known at compilation time
36+ --> $DIR/feature-gate-unsized_fn_params.rs:25:8
37+ |
38+ LL | fn qux(_: [()]) {}
39+ | ^ doesn't have a size known at compile-time
40+ |
41+ = help: the trait `Sized` is not implemented for `[()]`
42+ = help: unsized fn params are gated as an unstable feature
43+ help: function arguments must have a statically known size, borrowed types always have a known size
44+ |
45+ LL | fn qux(_: &[()]) {}
46+ | +
47+
48+ error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
49+ --> $DIR/feature-gate-unsized_fn_params.rs:29:9
1650 |
1751LL | foo(*x);
1852 | ^^ doesn't have a size known at compile-time
@@ -21,6 +55,6 @@ LL | foo(*x);
2155 = note: all function arguments must have a statically known size
2256 = help: unsized fn params are gated as an unstable feature
2357
24- error: aborting due to 2 previous errors
58+ error: aborting due to 4 previous errors
2559
2660For more information about this error, try `rustc --explain E0277`.
0 commit comments