@@ -6,13 +6,47 @@ LL | fn foo(x: dyn Foo) {
6
6
|
7
7
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
8
8
= 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
+ | ~~~~
9
13
help: function arguments must have a statically known size, borrowed types always have a known size
10
14
|
11
15
LL | fn foo(x: &dyn Foo) {
12
16
| +
13
17
14
18
error[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
16
50
|
17
51
LL | foo(*x);
18
52
| ^^ doesn't have a size known at compile-time
@@ -21,6 +55,6 @@ LL | foo(*x);
21
55
= note: all function arguments must have a statically known size
22
56
= help: unsized fn params are gated as an unstable feature
23
57
24
- error: aborting due to 2 previous errors
58
+ error: aborting due to 4 previous errors
25
59
26
60
For more information about this error, try `rustc --explain E0277`.
0 commit comments