Closed
Description
Code
fn main() {
struct StructA<A, B = A> {
_marker: std::marker::PhantomData<fn() -> (A, B)>,
}
struct StructB {
a: StructA<isize, [u8]>,
}
}
Current output
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> src\main.rs:7:12
|
7 | a: StructA<isize, [u8]>,
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `StructA`
--> src\main.rs:2:23
|
2 | struct StructA<A, B = A> {
| ^^^^^ required by this bound in `StructA`
help: consider relaxing the implicit `Sized` restriction
|
2 | struct StructA<A, B = A: ?Sized> {
| ++++++++
Desired output
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> src\main.rs:7:12
|
7 | a: StructA<isize, [u8]>,
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `StructA`
--> src\main.rs:2:23
|
2 | struct StructA<A, B = A> {
| ^^^^^ required by this bound in `StructA`
help: consider relaxing the implicit `Sized` restriction
|
2 | struct StructA<A, B: ?Sized = A> {
| ++++++++
Rationale and extra context
No response
Other cases
No response
Rust Version
$ rustc --version --verbose
rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-pc-windows-msvc
release: 1.76.0
LLVM version: 17.0.6
Anything else?
No response