authorgravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2025-01-28 22:55:02+11:00
committergravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2025-04-26 13:34:17+10:00
log2e9c1553ef40e9f21c2241294b8942369ef9007a
tree22d15fcbe3982914e1607fb14a7e4cb775f3bf7b
parent5cba7c8562a5646996ee022b249d829b68fb6870

std: deprecate std.mem.copy{Forwards,Backwards}


1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/mem.zig+2
...@@ -232,6 +232,7 @@ test "Allocator alloc and remap with zero-bit type" {...@@ -232,6 +232,7 @@ test "Allocator alloc and remap with zero-bit type" {
232/// Copy all of source into dest at position 0.232/// Copy all of source into dest at position 0.
233/// dest.len must be >= source.len.233/// dest.len must be >= source.len.
234/// If the slices overlap, dest.ptr must be <= src.ptr.234/// If the slices overlap, dest.ptr must be <= src.ptr.
235/// This function is deprecated; use @memmove instead.
235pub fn copyForwards(comptime T: type, dest: []T, source: []const T) void {236pub fn copyForwards(comptime T: type, dest: []T, source: []const T) void {
236 for (dest[0..source.len], source) |*d, s| d.* = s;237 for (dest[0..source.len], source) |*d, s| d.* = s;
237}238}
...@@ -239,6 +240,7 @@ pub fn copyForwards(comptime T: type, dest: []T, source: []const T) void {...@@ -239,6 +240,7 @@ pub fn copyForwards(comptime T: type, dest: []T, source: []const T) void {
239/// Copy all of source into dest at position 0.240/// Copy all of source into dest at position 0.
240/// dest.len must be >= source.len.241/// dest.len must be >= source.len.
241/// If the slices overlap, dest.ptr must be >= src.ptr.242/// If the slices overlap, dest.ptr must be >= src.ptr.
243/// This function is deprecated; use @memmove instead.
242pub fn copyBackwards(comptime T: type, dest: []T, source: []const T) void {244pub fn copyBackwards(comptime T: type, dest: []T, source: []const T) void {
243 // TODO instead of manually doing this check for the whole array245 // TODO instead of manually doing this check for the whole array
244 // and turning off runtime safety, the compiler should detect loops like246 // and turning off runtime safety, the compiler should detect loops like