diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index 69d4c3768db30..1d572ede9e429 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -450,7 +450,7 @@ impl Cell { // 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()); } }