]> git.lizzy.rs Git - rust.git/blob - src/test/ui/feature-gates/feature-gate-unsized_fn_params.stderr
Rollup merge of #105780 - GuillaumeGomez:read-more-links, r=notriddle
[rust.git] / src / test / ui / feature-gates / feature-gate-unsized_fn_params.stderr
1 error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
2   --> $DIR/feature-gate-unsized_fn_params.rs:17:8
3    |
4 LL | fn foo(x: dyn Foo) {
5    |        ^ doesn't have a size known at compile-time
6    |
7    = help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
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    |           ~~~~
13 help: function arguments must have a statically known size, borrowed types always have a known size
14    |
15 LL | fn foo(x: &dyn Foo) {
16    |           +
17
18 error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
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
50    |
51 LL |     foo(*x);
52    |         ^^ doesn't have a size known at compile-time
53    |
54    = help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
55    = note: all function arguments must have a statically known size
56    = help: unsized fn params are gated as an unstable feature
57
58 error: aborting due to 4 previous errors
59
60 For more information about this error, try `rustc --explain E0277`.