Skip to content

Remove unreachable #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented May 14, 2025

This improves the API of this crate to not use unreachable any more and is the continuation of rust-lang/rust#138163.

It also eliminates internal unreachable by inlining Mode methods into the *_common functions, and eliminates the resulting duplication by using traits instead. Using traits is much more verbose than a macro-based variant, because they are very explicit, but hopefully also a bit less unclear.

I've tried to use separate commits to explain the story, but have probably only succeeded at the beginning.

There is a companion PR to use this new API here: rust-lang/rust#140999

r? @nnethercote

hkBst added 5 commits May 14, 2025 11:22
The old API exposes `unreachable` in both unescape_unicode and unescape_mixed.
These are conceptually one function, but because their return types are incompatible,
they could not be unified.

The new API takes this insight further to separate unescape_unicode into separate functions,
such that byte functions can return bytes instead of chars.
@rust-cloud-vms rust-cloud-vms bot force-pushed the remove_unreachable branch from f816e0b to 00b6cfd Compare May 14, 2025 11:23
@GuillaumeGomez
Copy link
Member

Gonna take a look later on.

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