Skip to content

cowrcstr: Remove unnecessary release assert. - #452

Merged
emilio merged 1 commit into
mainfrom
cowrcstr-debug-assert
Aug 30, 2026
Merged

cowrcstr: Remove unnecessary release assert.#452
emilio merged 1 commit into
mainfrom
cowrcstr-debug-assert

Conversation

@emilio

@emilio emilio commented Aug 30, 2026

Copy link
Copy Markdown
Member

Rust guarantees that slices are never bigger than isize::MAX.

This came up because I was looking at whether it'd be possible to use one bit of the length field as a tag, and keep the str bytes as the pointer in the owned case too (so the conversion to str is just removing the tag).

But that doesn't seem feasible unless we go to Rc rather than Rc, which would enforce reallocating the escaped strings, which is a bit annoying... So I'm not pursuing that for now.

Rust guarantees that slices are never bigger than isize::MAX.

This came up because I was looking at whether it'd be possible to use
one bit of the length field as a tag, and keep the str bytes as the
pointer in the owned case too (so the conversion to str is just removing
the tag).

But that doesn't seem feasible unless we go to Rc<str> rather than
Rc<String>, which would enforce reallocating the escaped strings, which
is a bit annoying... So I'm not pursuing that for now.
@emilio
emilio added this pull request to the merge queue Aug 30, 2026
Merged via the queue into main with commit 16bcd0b Aug 30, 2026
14 checks passed
@emilio
emilio deleted the cowrcstr-debug-assert branch August 30, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants