Skip to content

Commit

Permalink
use mem::swap instead of ptr::swap_nonoverlapping
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 16, 2023
1 parent 26cfd21 commit e7a1e42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ impl<T> Cell<T> {
// either of these `Cell`s. We also excluded shenanigans like partially overlapping `Cell`s,
// so `swap` will just properly copy two full values of type `T` back and forth.
unsafe {
ptr::swap_nonoverlapping(self.value.get(), other.value.get(), 1);
mem::swap(&mut *self.value.get(), &mut *other.value.get());
}
}

Expand Down

0 comments on commit e7a1e42

Please sign in to comment.