You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A couple of times now I've tried to use SmallVec as a drop-in replacement for Vec within rustc, and it hasn't worked because SmallVec doesn't have #[may_dangle] annotations. (rust-lang/rust#55525 is one case; rust-lang/rust#56269 is the other.) That annotation is unstable so I think it would have to be behind a feature flag, but that would suffice for my purposes.
I'm not sure about the right way to do this, though. I tried changing this line:
impl<A: Array> Drop for SmallVec {
to this:
unsafe impl<#[may_dangle] A: Array> Drop for SmallVec {
For the current code I'm working on (rust-lang/rust#56269), where Vec works but SmallVec doesn't, this reduced the number of borrow checker errors from 4 to 2. So it helped, but didn't solve things completely. Maybe there's a better way to do it.
Activity
Add a new feature, `may_dangle`.
Auto merge of #133 - nnethercote:may_dangle, r=mbrubeck