Repository navigation
Conversation
Quest-Claim: 7ed00e0424c1a603
…init<u8>] A `&mut [u8]` counted as a mapped buffer, though no mapping writes one, so every call into its impl refused. It now translates from the MIR, as the `MaybeUninit` impl already did, and `ptr::write_bytes` of bytes maps, which the provided `put_bytes` reaches through the forwarding impls. Its other pointees are refused, and a write the body shows past an array JS keeps apart is too. A differential case writes an array through each slice, directly, through a `&mut`, and through a `Box`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head 0de9208600994217a125a9ca574882d7624a8b49 against base efa6300cc2a9be621b52d683179bcd8e49f9a672.
No actionable introduced findings identified.
The mutable-slice implementations now reach MIR without changing shared-slice mappings. I checked the generated slice cursor/backing-storage behavior against bytes' implementations, the byte-only pointer fill and origin checks, and the registered differential and rejection cases.
Direction: no changes requested from this review; retain the normal validation gates.
Verification limits: GitHub-only static review. I did not execute the translator, differential tests, or CI, and did not independently reproduce the reported results or pre-existing snapshot failures. This COMMENT is not an approval.
(Written by review (OpenAI))

Problem
bytes'impl BufMut for &mut [u8]refused at every call:mapped_self(ts/src/lower/stock.rs) counted any&[u8]or&mut [u8]as a mapped buffer, but noBuffermapping writes a mutable slice. Reproduced first with a new differential case: 45 refusals, all<&mut [u8] as bytes::BufMut>::*. The&mut [MaybeUninit<u8>]impl already translated from its MIR but forptr::write_bytes, which the providedput_bytesreaches through the forwarding&mut TandBox<T>impls (they don't forwardput_bytes) and theMaybeUninitimpl's ownput_bytescalls.Approach
mapped_selfcounts only a shared&[u8], so the&mut [u8]impl translates from MIR like the deque's in moq-dev/rust2#611:chunk_mutis the slice'srs.ByteSlice,advance_mutitsmem::take(self).split_at_mut(cnt).ptr::write_bytesand the*mut T/NonNullwrite_bytesmethods map to a newrs.ptrWriteBytesfor byte pointees (u8,MaybeUninit<u8>). Any other pointee is refused with a span, as JS keeps it as a value, not bytes. The origin check refuses a write the body shows reaching past an array JS keeps apart, as it doesptr::copy.buf::slices: writes a 255-byte array through a&mut [u8]and a&mut [MaybeUninit<u8>]of the room its input picks, bywrite_allandchunk_all(every provided and overridden method,chunk_mutwrites,advance_mutpast the room), directly, through a&mut, and through aBox, ending with the room left and both arrays whole. Of 320 inputs per kind, each of the 8 kinds reaches both completed writes (21 to 127) and panics.write_bytes::<u32>and awrite_bytespast a lone byte.Impact
BufMutfor&mut [u8]and&mut [MaybeUninit<u8>], andptr::write_bytesof bytes, now translate instead of refusing.rs.ptrWriteBytes.Caused by
No single PR:
mapped_selfhas counted every byte-slice reference sincebytes'Buf/BufMutmapping began, before any&mut [u8]consumer.Choices made without asking
write_bytescovers byte pointees only and refuses others (u32,i8, structs). Integers of every byte set alike (such as zeroing) could be supported, but no consumer reaches them; see Follow-ups.rs.ptrWriteBytessets byte by byte through the sameelemSetpath asptrCopy's fallback rather than aUint8Array.fillfast path: simpler, and nothing here is hot.Alternatives
&mut [u8]as a newBuffervariant in the bytes mapping. Rejected: the impl's MIR translates exactly with what exists, and a mapping would duplicatebytes' panics by hand.Follow-ups
ptr::write_bytesof non-byte pointees (integers and floats from a repeated byte, e.g. zeroing a[u32]): plan as an m3 quest, since rust2 aims for all of std and this refusal is a std gap with no consumer yet.Validation
just ci: lint passes; tests pass but for the two known TypeId-hash snapshots (ts/fixtures/lang/dyns/expected/ids.ts,ts/fixtures/lang/panics/hook/expected/lib.ts), which differ only in hash strings, reproduce on bareorigin/mainper the coordinator, and moq-dev/rust2#633 fixes.stockdifferential: 0 differences.Models
Size: S
Implementer: Claude Code, claude-opus-5-5, high effort
(Written by Claude Opus 5.5 with high effort)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.01a1b538-0a34-7080-ac34-8e28ac2dc77c, round 1No actionable defects were found in the specified diff; 400 focused differential cases passed using existing build artifacts, although the full suite was blocked by the read-only environment.