arrayvec icon indicating copy to clipboard operation
arrayvec copied to clipboard

Follow simplification of Vec::retain() (rust-lang/rust#91527)

Open niklasf opened this issue 3 years ago • 3 comments

Follows rust-lang/rust#91527. This is neutral in my go-to benchmarks, but it's probably good to keep the implementation in sync regardless.

Edit: Looks like miri does not like this, whereas it doesn't mind std. Reminds me of https://github.com/bluss/arrayvec/pull/174#pullrequestreview-594795729. Will debug later.

niklasf avatar Dec 23 '21 09:12 niklasf

Fixed by dereferencing the pointer only for f(unsafe { &mut *cur }). To be honest, I don't understand how std gets away with not doing it like that.

niklasf avatar Dec 23 '21 19:12 niklasf

@bluss Can we merge that? It would fix complains of miri about retain. https://github.com/bluss/arrayvec/issues/221

AngelicosPhosphoros avatar Jul 17 '22 19:07 AngelicosPhosphoros

@niklasf At this moment miri also don't like ArrayVec::drain and ArrayVec::retain.

P.S. How about adding my code from issue as test to ensure that it remains valid?

AngelicosPhosphoros avatar Jul 17 '22 19:07 AngelicosPhosphoros

Looks like the stacked borrow violations have been addressed in a different way.

niklasf avatar Apr 09 '23 15:04 niklasf