From e7a1e4271d3c65fb707518d89890195faab29efe Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 16 Aug 2023 08:47:06 +0200 Subject: [PATCH] use mem::swap instead of ptr::swap_nonoverlapping --- library/core/src/cell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()); } }