Skip to content

Commit

Permalink
Fix mutable reborrow
Browse files Browse the repository at this point in the history
Co-authored-by: bluss <bluss@users.noreply.github.com>
  • Loading branch information
niklasf and bluss committed Mar 29, 2021
1 parent 345c6b4 commit c094906
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/arrayvec.rs
Expand Up @@ -478,8 +478,8 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
let mut g = BackshiftOnDrop { v: self, processed_len: 0, deleted_cnt: 0, original_len };

while g.processed_len < original_len {
let cur = unsafe { &mut *g.v.as_mut_ptr().add(g.processed_len) };
if !f(cur) {
let cur = unsafe { g.v.as_mut_ptr().add(g.processed_len) };
if !f(unsafe { &mut *cur }) {
g.processed_len += 1;
g.deleted_cnt += 1;
unsafe { ptr::drop_in_place(cur) };
Expand Down

0 comments on commit c094906

Please sign in to comment.