From a34a3bed9bd7fb49f0f6b2846edaee2891a34e93 Mon Sep 17 00:00:00 2001 From: Conor Bronsdon <120674402+conorbronsdon@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:33:08 -0700 Subject: [PATCH] Fix the two stdlib breakages blocking every mojo-redis build Both the test and docs workflows have failed since the repo was published -- neither has ever been green -- and both fail on the same two errors. InlineArray no longer conforms to ImplicitlyCopyable, so returning the local `octets` out of _parse_ipv4 needs an explicit transfer. The value is dead after the return, so `^` is right; `.copy()` would add a needless copy of 4 bytes. UnsafePointer split safe and unsafe variants, and `__add__` now carries a `where Self._is_unsafe` constraint that List.unsafe_ptr()'s return type does not satisfy. `unsafe_offset` is the same operation with no such constraint -- it is what `__add__` itself forwards to -- so the pointer arithmetic is unchanged in behaviour. Leaves the init_pointee_copy deprecation warnings alone; they are warnings, not errors, and swapping them for unsafe_write is a separate change. Co-Authored-By: Claude Opus 5 (1M context) --- src/redis/connection.mojo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/redis/connection.mojo b/src/redis/connection.mojo index 64aec09..6395f34 100644 --- a/src/redis/connection.mojo +++ b/src/redis/connection.mojo @@ -94,7 +94,7 @@ def _parse_ipv4(host: String) raises -> InlineArray[UInt8, 4]: i += 1 if idx != 4: raise Error("redis: invalid IPv4 host '" + host + "'") - return octets + return octets^ struct Connection(Movable): @@ -198,7 +198,7 @@ struct Connection(Movable): send_flags = Int32(0) while sent < total: var n = external_call["send", Int]( - self.fd, ptr + sent, total - sent, send_flags + self.fd, ptr.unsafe_offset(sent), total - sent, send_flags ) if n <= 0: # A failed write leaves the connection unusable; close it so a