Conversation
|
Participation of PhantomData in dropck is absolutely crucial, as explained in the Nomicon. The RFC fails to explain how the standard library should implement So I think this is a non-starter of a proposal. (Also the 'rendered' link is broken.) |
|
we're convinced PhantomData isn't required for dropck today, except for variance and auto traits, specifically because of nonparametric drop. but we'll be honest: we haven't actually tested it. we'd be extremely surprised if the following were somehow wrong tho: /// A mostly-no-op wrapper around `T` which happens to be explicitly `Drop`.
struct Wrapper<T>(ManuallyDrop<T>);
unsafe impl<#[may_dangle] T> Drop for Wrapper<T> {
fn drop(&mut self) {
unsafe {
ManuallyDrop::drop(&mut self.0);
}
}
}edit: ah, looks like |
|
do we just
(do we want a refinement of may_dangle?) |
|
we're just gonna close this for now but we plan on revisiting it later. |
Rendered
We had a lot of fun writing this and even learned some new things! =^-^=
Basically after a lot of thought we think this is the proper way to handle rust-lang/rust#102810