We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13bf0b2 commit d7341f3Copy full SHA for d7341f3
library/core/src/slice/mod.rs
@@ -3096,7 +3096,11 @@ impl<T> [T] {
3096
// SAFETY: the conditions for `ptr::copy` have all been checked above,
3097
// as have those for `ptr::add`.
3098
unsafe {
3099
- ptr::copy(self.as_ptr().add(src_start), self.as_mut_ptr().add(dest), count);
+ // Derive both `src_ptr` and `dest_ptr` from the same loan
3100
+ let ptr = self.as_mut_ptr();
3101
+ let src_ptr = ptr.add(src_start);
3102
+ let dest_ptr = ptr.add(dest);
3103
+ ptr::copy(src_ptr, dest_ptr, count);
3104
}
3105
3106
0 commit comments