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.
The text was updated successfully, but these errors were encountered:
This commit adds a `may_dangle` annotation to `drop`, matching `Vec`.
This feature increases the ability of `SmallVec` to be used as a drop-in
replacement for `Vec`. A feature is necessary because `may_dangle` is
Nightly-only.
Fixesservo#132.
Add a new feature, `may_dangle`.
This commit adds a `may_dangle` annotation to `drop`, matching `Vec`.
This feature increases the ability of `SmallVec` to be used as a drop-in
replacement for `Vec`. A feature is necessary because `may_dangle` is
Nightly-only.
Fixes#132.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/133)
<!-- Reviewable:end -->
A couple of times now I've tried to use
SmallVec
as a drop-in replacement forVec
within rustc, and it hasn't worked becauseSmallVec
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:
to this:
For the current code I'm working on (rust-lang/rust#56269), where
Vec
works butSmallVec
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.The text was updated successfully, but these errors were encountered: