1
1
error[E0277]: the size for values of type `X` cannot be known at compilation time
2
2
--> $DIR/unsized3.rs:7:13
3
3
|
4
+ LL | fn f1<X: ?Sized>(x: &X) {
5
+ | - this type parameter needs to be `std::marker::Sized`
4
6
LL | f2::<X>(x);
5
7
| ^ doesn't have a size known at compile-time
6
8
...
7
9
LL | fn f2<X>(x: &X) {
8
- | -- - required by this bound in `f2`
10
+ | -- -- help: consider relaxing the implicit `Sized` restriction: `: ?Sized`
11
+ | |
12
+ | required by this bound in `f2`
9
13
|
10
14
= help: the trait `std::marker::Sized` is not implemented for `X`
11
15
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
12
- help: consider further restricting this bound
13
- |
14
- LL | fn f1<X: std::marker::Sized + ?Sized>(x: &X) {
15
- | ^^^^^^^^^^^^^^^^^^^^^^^
16
- help: consider relaxing the implicit `Sized` restriction
17
- |
18
- LL | fn f2<X: ?Sized>(x: &X) {
19
- | ^^^^^^^^
20
16
21
17
error[E0277]: the size for values of type `X` cannot be known at compilation time
22
18
--> $DIR/unsized3.rs:18:13
23
19
|
20
+ LL | fn f3<X: ?Sized + T>(x: &X) {
21
+ | - this type parameter needs to be `std::marker::Sized`
24
22
LL | f4::<X>(x);
25
23
| ^ doesn't have a size known at compile-time
26
24
...
27
25
LL | fn f4<X: T>(x: &X) {
28
- | -- - required by this bound in `f4`
26
+ | -- - - help: consider relaxing the implicit `Sized` restriction: `+ ?Sized`
27
+ | |
28
+ | required by this bound in `f4`
29
29
|
30
30
= help: the trait `std::marker::Sized` is not implemented for `X`
31
31
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
32
- help: consider further restricting this bound
33
- |
34
- LL | fn f3<X: std::marker::Sized + ?Sized + T>(x: &X) {
35
- | ^^^^^^^^^^^^^^^^^^^^^^^
36
- help: consider relaxing the implicit `Sized` restriction
37
- |
38
- LL | fn f4<X: T + ?Sized>(x: &X) {
39
- | ^^^^^^^^^
40
32
41
33
error[E0277]: the size for values of type `X` cannot be known at compilation time
42
34
--> $DIR/unsized3.rs:33:8
@@ -45,7 +37,7 @@ LL | fn f5<Y>(x: &Y) {}
45
37
| -- - required by this bound in `f5`
46
38
...
47
39
LL | fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) {
48
- | -- help: consider further restricting this bound: `X: std::marker::Sized + `
40
+ | - this type parameter needs to be ` std::marker::Sized`
49
41
LL | f5(x1);
50
42
| ^^ doesn't have a size known at compile-time
51
43
|
@@ -57,7 +49,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
57
49
--> $DIR/unsized3.rs:40:8
58
50
|
59
51
LL | fn f9<X: ?Sized>(x1: Box<S<X>>) {
60
- | -- help: consider further restricting this bound: `X: std::marker::Sized + `
52
+ | - this type parameter needs to be ` std::marker::Sized`
61
53
LL | f5(&(*x1, 34));
62
54
| ^^^^^^^^^^ doesn't have a size known at compile-time
63
55
|
@@ -70,7 +62,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
70
62
--> $DIR/unsized3.rs:45:9
71
63
|
72
64
LL | fn f10<X: ?Sized>(x1: Box<S<X>>) {
73
- | -- help: consider further restricting this bound: `X: std::marker::Sized + `
65
+ | - this type parameter needs to be ` std::marker::Sized`
74
66
LL | f5(&(32, *x1));
75
67
| ^^^^^^^^^ doesn't have a size known at compile-time
76
68
|
@@ -87,7 +79,7 @@ LL | fn f5<Y>(x: &Y) {}
87
79
| -- - required by this bound in `f5`
88
80
...
89
81
LL | fn f10<X: ?Sized>(x1: Box<S<X>>) {
90
- | -- help: consider further restricting this bound: `X: std::marker::Sized + `
82
+ | - this type parameter needs to be ` std::marker::Sized`
91
83
LL | f5(&(32, *x1));
92
84
| ^^^^^^^^^^ doesn't have a size known at compile-time
93
85
|
0 commit comments