Add non-`#[may_dangle]` mention to dropck mechanic

pull/417/head
Daniel Henry-Mantilla 2 years ago committed by GitHub
parent b372cea91f
commit 8f6451a364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -110,6 +110,11 @@ When a type already has a `Drop impl`, **adding an extra `_owns_T: PhantomData<T
is thus _superfluous_ and accomplishes nothing**, dropck-wise (it still affects variance
and auto-traits).
- (advanced edge case: if the type containing the `PhantomData` has no `Drop` impl at all,
but still has drop glue (by having _another_ field with drop glue), then the
dropck/`#[may_dangle]` considerations mentioned herein do apply as well: a `PhantomData<T>`
field will then require `T` to be droppable whenever the containing type goes out of scope).
___
But this situation can sometimes lead to overly restrictive code. That's why the

Loading…
Cancel
Save