fork/rust

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

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

master
3.1 KiB81 linesraw
1error[E0277]: the size for values of type `T` cannot be known at compilation time
2  --> $DIR/union-sized-field.rs:4:12
3   |
4LL | union Foo<T: ?Sized> {
5   |           - this type parameter needs to be `Sized`
6LL |     value: ManuallyDrop<T>,
7   |            ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
8   |
9note: required because it appears within the type `ManuallyDrop<T>`
10  --> $SRC_DIR/core/src/mem/manually_drop.rs:LL:COL
11   = note: no field of a union may have a dynamically sized type
12   = help: change the field's type to have a statically known size
13help: consider removing the `?Sized` bound to make the type parameter `Sized`
14   |
15LL - union Foo<T: ?Sized> {
16LL + union Foo<T> {
17   |
18help: borrowed types always have a statically known size
19   |
20LL |     value: &ManuallyDrop<T>,
21   |            +
22help: the `Box` type always has a statically known size and allocates its contents in the heap
23   |
24LL |     value: Box<ManuallyDrop<T>>,
25   |            ++++               +
26
27error[E0277]: the size for values of type `T` cannot be known at compilation time
28  --> $DIR/union-sized-field.rs:9:12
29   |
30LL | struct Foo2<T: ?Sized> {
31   |             - this type parameter needs to be `Sized`
32LL |     value: ManuallyDrop<T>,
33   |            ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
34   |
35note: required because it appears within the type `ManuallyDrop<T>`
36  --> $SRC_DIR/core/src/mem/manually_drop.rs:LL:COL
37   = note: only the last field of a struct may have a dynamically sized type
38   = help: change the field's type to have a statically known size
39help: consider removing the `?Sized` bound to make the type parameter `Sized`
40   |
41LL - struct Foo2<T: ?Sized> {
42LL + struct Foo2<T> {
43   |
44help: borrowed types always have a statically known size
45   |
46LL |     value: &ManuallyDrop<T>,
47   |            +
48help: the `Box` type always has a statically known size and allocates its contents in the heap
49   |
50LL |     value: Box<ManuallyDrop<T>>,
51   |            ++++               +
52
53error[E0277]: the size for values of type `T` cannot be known at compilation time
54  --> $DIR/union-sized-field.rs:15:11
55   |
56LL | enum Foo3<T: ?Sized> {
57   |           - this type parameter needs to be `Sized`
58LL |     Value(ManuallyDrop<T>),
59   |           ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
60   |
61note: required because it appears within the type `ManuallyDrop<T>`
62  --> $SRC_DIR/core/src/mem/manually_drop.rs:LL:COL
63   = note: no field of an enum variant may have a dynamically sized type
64   = help: change the field's type to have a statically known size
65help: consider removing the `?Sized` bound to make the type parameter `Sized`
66   |
67LL - enum Foo3<T: ?Sized> {
68LL + enum Foo3<T> {
69   |
70help: borrowed types always have a statically known size
71   |
72LL |     Value(&ManuallyDrop<T>),
73   |           +
74help: the `Box` type always has a statically known size and allocates its contents in the heap
75   |
76LL |     Value(Box<ManuallyDrop<T>>),
77   |           ++++               +
78
79error: aborting due to 3 previous errors
80
81For more information about this error, try `rustc --explain E0277`.