fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.9 KiB53 linesraw
1error[E0277]: the size for values of type `T` cannot be known at compilation time
2  --> $DIR/unsized-struct.rs:6:36
3   |
4LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
5   |         -                          ^^^^^^ doesn't have a size known at compile-time
6   |         |
7   |         this type parameter needs to be `Sized`
8   |
9note: required by a bound in `Foo`
10  --> $DIR/unsized-struct.rs:4:12
11   |
12LL | struct Foo<T> { data: T }
13   |            ^ required by this bound in `Foo`
14help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
15  --> $DIR/unsized-struct.rs:4:12
16   |
17LL | struct Foo<T> { data: T }
18   |            ^          - ...if indirection were used here: `Box<T>`
19   |            |
20   |            this could be changed to `T: ?Sized`...
21help: consider removing the `?Sized` bound to make the type parameter `Sized`
22   |
23LL - fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
24LL + fn foo2<T>() { not_sized::<Foo<T>>() }
25   |
26
27error[E0277]: the size for values of type `T` cannot be known at compilation time
28  --> $DIR/unsized-struct.rs:13:35
29   |
30LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
31   |         -                         ^^^^^^ doesn't have a size known at compile-time
32   |         |
33   |         this type parameter needs to be `Sized`
34   |
35note: required because it appears within the type `Bar<T>`
36  --> $DIR/unsized-struct.rs:11:8
37   |
38LL | struct Bar<T: ?Sized> { data: T }
39   |        ^^^
40note: required by a bound in `is_sized`
41  --> $DIR/unsized-struct.rs:1:13
42   |
43LL | fn is_sized<T:Sized>() { }
44   |             ^ required by this bound in `is_sized`
45help: consider removing the `?Sized` bound to make the type parameter `Sized`
46   |
47LL - fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
48LL + fn bar2<T>() { is_sized::<Bar<T>>() }
49   |
50
51error: aborting due to 2 previous errors
52
53For more information about this error, try `rustc --explain E0277`.