]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsized6.stderr
Suggest borrowing in more unsized fn param cases
[rust.git] / src / test / ui / unsized6.stderr
1 error[E0277]: the size for values of type `Y` cannot be known at compilation time
2   --> $DIR/unsized6.rs:9:9
3    |
4 LL | fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
5    |                             - this type parameter needs to be `std::marker::Sized`
6 ...
7 LL |     let y: Y;
8    |         ^ doesn't have a size known at compile-time
9    |
10    = help: the trait `std::marker::Sized` is not implemented for `Y`
11    = note: all local variables must have a statically known size
12    = help: unsized locals are gated as an unstable feature
13
14 error[E0277]: the size for values of type `X` cannot be known at compilation time
15   --> $DIR/unsized6.rs:7:12
16    |
17 LL | fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
18    |                  - this type parameter needs to be `std::marker::Sized`
19 LL |     let _: W; // <-- this is OK, no bindings created, no initializer.
20 LL |     let _: (isize, (X, isize));
21    |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
22    |
23    = help: the trait `std::marker::Sized` is not implemented for `X`
24    = note: only the last element of a tuple may have a dynamically sized type
25
26 error[E0277]: the size for values of type `Z` cannot be known at compilation time
27   --> $DIR/unsized6.rs:11:12
28    |
29 LL | fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
30    |                                        - this type parameter needs to be `std::marker::Sized`
31 ...
32 LL |     let y: (isize, (Z, usize));
33    |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
34    |
35    = help: the trait `std::marker::Sized` is not implemented for `Z`
36    = note: only the last element of a tuple may have a dynamically sized type
37
38 error[E0277]: the size for values of type `X` cannot be known at compilation time
39   --> $DIR/unsized6.rs:15:9
40    |
41 LL | fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
42    |       - this type parameter needs to be `std::marker::Sized`
43 LL |     let y: X;
44    |         ^ doesn't have a size known at compile-time
45    |
46    = help: the trait `std::marker::Sized` is not implemented for `X`
47    = note: all local variables must have a statically known size
48    = help: unsized locals are gated as an unstable feature
49
50 error[E0277]: the size for values of type `Y` cannot be known at compilation time
51   --> $DIR/unsized6.rs:17:12
52    |
53 LL | fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
54    |                  - this type parameter needs to be `std::marker::Sized`
55 ...
56 LL |     let y: (isize, (Y, isize));
57    |            ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
58    |
59    = help: the trait `std::marker::Sized` is not implemented for `Y`
60    = note: only the last element of a tuple may have a dynamically sized type
61
62 error[E0277]: the size for values of type `X` cannot be known at compilation time
63   --> $DIR/unsized6.rs:22:9
64    |
65 LL | fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
66    |       - this type parameter needs to be `std::marker::Sized`
67 LL |     let y: X = *x1;
68    |         ^ doesn't have a size known at compile-time
69    |
70    = help: the trait `std::marker::Sized` is not implemented for `X`
71    = note: all local variables must have a statically known size
72    = help: unsized locals are gated as an unstable feature
73
74 error[E0277]: the size for values of type `X` cannot be known at compilation time
75   --> $DIR/unsized6.rs:24:9
76    |
77 LL | fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
78    |       - this type parameter needs to be `std::marker::Sized`
79 ...
80 LL |     let y = *x2;
81    |         ^ doesn't have a size known at compile-time
82    |
83    = help: the trait `std::marker::Sized` is not implemented for `X`
84    = note: all local variables must have a statically known size
85    = help: unsized locals are gated as an unstable feature
86
87 error[E0277]: the size for values of type `X` cannot be known at compilation time
88   --> $DIR/unsized6.rs:26:10
89    |
90 LL | fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
91    |       - this type parameter needs to be `std::marker::Sized`
92 ...
93 LL |     let (y, z) = (*x3, 4);
94    |          ^ doesn't have a size known at compile-time
95    |
96    = help: the trait `std::marker::Sized` is not implemented for `X`
97    = note: all local variables must have a statically known size
98    = help: unsized locals are gated as an unstable feature
99
100 error[E0277]: the size for values of type `X` cannot be known at compilation time
101   --> $DIR/unsized6.rs:30:9
102    |
103 LL | fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
104    |       - this type parameter needs to be `std::marker::Sized`
105 LL |     let y: X = *x1;
106    |         ^ doesn't have a size known at compile-time
107    |
108    = help: the trait `std::marker::Sized` is not implemented for `X`
109    = note: all local variables must have a statically known size
110    = help: unsized locals are gated as an unstable feature
111
112 error[E0277]: the size for values of type `X` cannot be known at compilation time
113   --> $DIR/unsized6.rs:32:9
114    |
115 LL | fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
116    |       - this type parameter needs to be `std::marker::Sized`
117 ...
118 LL |     let y = *x2;
119    |         ^ doesn't have a size known at compile-time
120    |
121    = help: the trait `std::marker::Sized` is not implemented for `X`
122    = note: all local variables must have a statically known size
123    = help: unsized locals are gated as an unstable feature
124
125 error[E0277]: the size for values of type `X` cannot be known at compilation time
126   --> $DIR/unsized6.rs:34:10
127    |
128 LL | fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
129    |       - this type parameter needs to be `std::marker::Sized`
130 ...
131 LL |     let (y, z) = (*x3, 4);
132    |          ^ doesn't have a size known at compile-time
133    |
134    = help: the trait `std::marker::Sized` is not implemented for `X`
135    = note: all local variables must have a statically known size
136    = help: unsized locals are gated as an unstable feature
137
138 error[E0277]: the size for values of type `X` cannot be known at compilation time
139   --> $DIR/unsized6.rs:38:18
140    |
141 LL | fn g1<X: ?Sized>(x: X) {}
142    |       -          ^ doesn't have a size known at compile-time
143    |       |
144    |       this type parameter needs to be `std::marker::Sized`
145    |
146    = help: the trait `std::marker::Sized` is not implemented for `X`
147    = help: unsized locals are gated as an unstable feature
148 help: function arguments must have a statically known size, borrowed types always have a known size
149    |
150 LL | fn g1<X: ?Sized>(x: &X) {}
151    |                     ^
152
153 error[E0277]: the size for values of type `X` cannot be known at compilation time
154   --> $DIR/unsized6.rs:40:22
155    |
156 LL | fn g2<X: ?Sized + T>(x: X) {}
157    |       -              ^ doesn't have a size known at compile-time
158    |       |
159    |       this type parameter needs to be `std::marker::Sized`
160    |
161    = help: the trait `std::marker::Sized` is not implemented for `X`
162    = help: unsized locals are gated as an unstable feature
163 help: function arguments must have a statically known size, borrowed types always have a known size
164    |
165 LL | fn g2<X: ?Sized + T>(x: &X) {}
166    |                         ^
167
168 error: aborting due to 13 previous errors
169
170 For more information about this error, try `rustc --explain E0277`.