-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
ManuallyDrop<T> where T: ?Sized #47034
Comments
Doesn't seem possible until we get by-value DSTs |
@jonas-schievink care to explain why? |
Ah, nevermind. It would just need to make |
The struct Foo<T>(ManuallyDrop<T>);
let foo = Box::new(Foo(ManuallyDrop::new(5i32))) as Box<Foo<::std::any::Any>; |
I guess this would be possible by allowing |
Change ManuallyDrop<T> to a lang item. This PR implements the approach @RalfJung proposes in https://internals.rust-lang.org/t/pre-rfc-unions-drop-types-and-manuallydrop/8025 (lang item `struct` instead of `union`). A followup PR can easily solve #47034 as well, by just adding a few `?Sized` to `libcore/mem.rs`. r? @nikomatsakis
unsized ManuallyDrop I think this matches what @eddyb had in rust-lang#52711 originally. ~~However, I have never added a `CoerceUnsized` before so I am not sure if I did this right. I copied the `unstable` attribute on the `impl` from elsewhere, but AFAIK it is useless because `impl`'s are insta-stable... so shouldn't this rather say "stable since 1.30"?~~ This is insta-stable and hence requires FCP, at least. Fixes rust-lang#47034
unsized ManuallyDrop I think this matches what @eddyb had in #52711 originally. ~~However, I have never added a `CoerceUnsized` before so I am not sure if I did this right. I copied the `unstable` attribute on the `impl` from elsewhere, but AFAIK it is useless because `impl`'s are insta-stable... so shouldn't this rather say "stable since 1.30"?~~ This is insta-stable and hence requires FCP, at least. Fixes #47034
ManuallyDrop<T>
currently requiresT: Sized
. It would be nice if we could remove this restriction. I'm not sure how to do it with the current implementation usingunion
though.The text was updated successfully, but these errors were encountered: