313714331a
Fixes an ICE that occurs when a struct with an unsized field at a non-last position is const evaluated.
107 lines
4.3 KiB
Plaintext
107 lines
4.3 KiB
Plaintext
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
|
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:10:17
|
|
|
|
|
LL | pub field2: str, // Unsized field that is not the last field
|
|
| ^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: the trait `Sized` is not implemented for `str`
|
|
= note: only the last field of a struct may have a dynamically sized type
|
|
= help: change the field's type to have a statically known size
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
LL | pub field2: &str, // Unsized field that is not the last field
|
|
| +
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
|
|
|
|
LL | pub field2: Box<str>, // Unsized field that is not the last field
|
|
| ++++ +
|
|
|
|
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
|
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:18:17
|
|
|
|
|
LL | field2: str, // Unsized
|
|
| ^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: the trait `Sized` is not implemented for `str`
|
|
= note: no field of an enum variant may have a dynamically sized type
|
|
= help: change the field's type to have a statically known size
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
LL | field2: &str, // Unsized
|
|
| +
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
|
|
|
|
LL | field2: Box<str>, // Unsized
|
|
| ++++ +
|
|
|
|
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
|
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:27:9
|
|
|
|
|
LL | str, // Unsized
|
|
| ^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: the trait `Sized` is not implemented for `str`
|
|
= note: no field of an enum variant may have a dynamically sized type
|
|
= help: change the field's type to have a statically known size
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
LL | &str, // Unsized
|
|
| +
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
|
|
|
|
LL | Box<str>, // Unsized
|
|
| ++++ +
|
|
|
|
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
|
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:37:17
|
|
|
|
|
LL | field2: str, // Unsized
|
|
| ^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: the trait `Sized` is not implemented for `str`
|
|
= note: no field of an enum variant may have a dynamically sized type
|
|
= help: change the field's type to have a statically known size
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
LL | field2: &str, // Unsized
|
|
| +
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
|
|
|
|
LL | field2: Box<str>, // Unsized
|
|
| ++++ +
|
|
|
|
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
|
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:13
|
|
|
|
|
LL | field2: str, // Unsized
|
|
| ^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: the trait `Sized` is not implemented for `str`
|
|
= note: no field of a union may have a dynamically sized type
|
|
= help: change the field's type to have a statically known size
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
LL | field2: &str, // Unsized
|
|
| +
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
|
|
|
|
LL | field2: Box<str>, // Unsized
|
|
| ++++ +
|
|
|
|
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
|
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
|
|
|
|
|
LL | field2: str, // Unsized
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
|
|
help: wrap the field type in `ManuallyDrop<...>`
|
|
|
|
|
LL | field2: std::mem::ManuallyDrop<str>, // Unsized
|
|
| +++++++++++++++++++++++ +
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
Some errors have detailed explanations: E0277, E0740.
|
|
For more information about an error, try `rustc --explain E0277`.
|