-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE: Unsized struct type with no unsized type params? #16977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This should be a compiler error, not an ICE. The error is (or should be) that |
Why would this be an error? Isn't enabling this kind of code part of the goal of DST? |
@Kimundi Not quite. We want to allow struct's last field to be potentially unsized, but it must be possible to have a sized version too. This is because only sized types can be instantiated. Since there is no possible sized version of |
Hm, I see. This is kinda unfortunate though, because you can't hide away the actual slice type from your wrapper. Eg, you could do struct MatrixPtr_<Sized? T> {
stride: uint,
data: T,
}
pub type MatrixPtr = MatrixPtr_<[T]>; But that widens your wrapper to possibly be instantiated with more than Maybe allow a struct definition like struct MatrixPtr<T> {
stride: uint,
data: [T],
} but to use it you need to transmute something like As an aside, the example in this issue would probably not work anyway, as the stride should presumably be stored per pointer, and not once in the target matrices backing memory. But this is till relevant for newtype wrappers around |
STR
Backtrace
Version
cc @nick29581
The text was updated successfully, but these errors were encountered: