-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement TryFrom<char>
for u8
#84640
Conversation
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
r? @SimonSapin |
I would have preferred if we didn’t expose conversions between bytes and Unicode through generic conversion traits that do not make the choice of character encoding visible. However since we already have that same conversion the other way around, at this point that’s not a reason not to add this one. Still, please expand the doc-comment to discuss encodings like https://doc.rust-lang.org/std/primitive.char.html#impl-From%3Cu8%3E does. In fact that can be mostly copy-pasted, with things like "encode" instead of "decode". Also please have the docs on the impl rather than only the method. Some rustdoc views fold/hide the latter. |
bf3b654
to
b383d78
Compare
Updated the doc comment.
Indeed. If |
@bors r+ |
📌 Commit b383d7885ba7bcd0da670e4ba7ac2ec5ad76e618 has been approved by |
Shouldn't this go through FCP first? Regardless, the @bors r- |
Ah right. Updated that to |
Oh right, I forgot this is insta-stable. As discussed above, this conversion complements the existing @rfcbot fcp merge |
Let's try that again and see if rfcbot notices: @rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This should be fixed if you use intra-doc links. Since #87073 rustdoc allows anchors in links to primitives, but you'll have to wait a few weeks for the bootstrap compiler to be bumped. |
Oh right, I forgot I already commented on this PR 🤦 |
This comment has been minimized.
This comment has been minimized.
Updated the error type and the doc link, though that's still not working. Not sure what the schedule for bootstrap compile updates is. |
Rebasing now that that PR is merged, CI is passing. |
Sorry for the delay. This looks ready to merge now. Can you update the stabilization version to 1.59.0? |
Previously suggested in rust-lang/rfcs#2854. It makes sense to have this since `char` implements `From<u8>`. Likewise `u32`, `u64`, and `u128` (since rust-lang#79502) implement `From<char>`.
@bors r+ p=1 rollup |
📌 Commit a02639d has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#84640 (Implement `TryFrom<char>` for `u8`) - rust-lang#92336 (Remove &self from PrintState::to_string) - rust-lang#92375 (Consolidate checking for msvc when generating debuginfo) - rust-lang#92568 (Add note about non_exhaustive to variant_count) - rust-lang#92600 (Add some missing `#[must_use]` to some `f{32,64}` operations) - rust-lang#92610 (Create CSS class instead of using inline style for search results) - rust-lang#92632 (Implement stabilization of `#[feature(available_parallelism)]`) - rust-lang#92650 (Fix typo in `StableCrateId` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Previously suggested in rust-lang/rfcs#2854.
It makes sense to have this since
char
implementsFrom<u8>
. Likewiseu32
,u64
, andu128
(since #79502) implementFrom<char>
.