Repository navigation
chore(quest): plan matching a Cow<str>'s variant - #541
Conversation
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 50 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. CodeRabbit Verify
|
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- New quest doc
quest/m3/ts-cow-str-variant.md— plans matching aCow<str>'sBorrowed/Ownedandinto_owned/to_mut's variant semantics, noting what refuses today and laying out three representation options to measure on the TS bench and moq's codec. - Index row in
quest/m3/README.md— links the new quest from m3's list.
Quest-only plan, no code. I verified the plan's claims against the source: the library::cow_variant refusal sites match (ts/src/lower/mir/place.rs:644, ts/src/lower/mir/place.rs:1245, ts/src/lower/mir/rvalue.rs:562, ts/src/lower/library.rs:2590); into_owned indeed returns the text unchanged and to_mut is same_place while nothing reads the variant; Cow<[T]> splits on rt.Borrowed/rt.ByteSlice as the shape hint says; and the lang/cows, lang/utf8, and reject fixtures all exist as named. Format matches neighboring m3 quest docs.
(Written by glm-5.3-flash)
glm-5.3-flash | 𝕏
|
|
||
| `Cow<[T]>` already keeps its variant (`rt.Borrowed`, or a `ByteSlice` against a | ||
| `ByteVec`), which may suggest a shape. The tests belong in the `lang/cows` and `lang/utf8` | ||
| fixtures. The `reject` fixture's `Cow<str>` cases move to them. |
There was a problem hiding this comment.
Not every Cow<str> case in reject/src/strs.rs can move: cow_borrowed asks is_borrowed on a Cow<str>, which this quest keeps refused. Worth scoping this to the cases the quest resolves (the match), leaving cow_borrowed in place.
Technical details
# reject fixture's Cow<str> cases can't all move
## Affected sites
- quest/m3/ts-cow-str-variant.md:42 — "The `reject` fixture's `Cow<str>` cases move to them" sweeps in `cow_borrowed`, which stays refused.
## Required outcome
- The plan should say only the variant-matching case (`cow_matched`) moves to `lang/cows`; `cow_borrowed` (`is_borrowed` on a `Cow<str>`) stays in `reject` because `is_borrowed` remains refused per the Goal.
## Suggested approach
- "The `reject` fixture's matching case moves there" or naming `cow_matched` directly.
Problem
A
Cow<str>is a plain JS string (#105), so matching itsBorrowedorOwnedvariant is refused, andto_mutnever changes the variant. Found in #537, where the variant offrom_utf8_lossy's result can't be tested. The maintainer chose to plan it on 2026-11-03.Approach
Adds
quest/m3/ts-cow-str-variant.md[L], linked fromquest/m3/README.md:into_ownedandto_mut, translate as std's do, proven by differential tests that includefrom_utf8_lossy's variant.is_borrowed/is_ownedare unstable (cow_is_borrowed) and stay refused.Impact
Alternatives
Cow<str>without variants for good: it conflicts with the plan to cover all of std.Follow-ups
None.
Review
Skipped: a quest-only plan with no code.
just checkpassed on922e4c451553f9422f127f01dc3e689de9dadd63.🤖 Generated with Claude Code