-
Notifications
You must be signed in to change notification settings - Fork 13.3k
wtf8, char: Replace uses of mem::transmute
with more specific functions
#27233
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
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 0eb552a has been approved by |
/// Converts a `u32` to an `char`, not checking whether it is a valid unicode | ||
/// codepoint. | ||
#[inline] | ||
pub unsafe fn from_u32_unchecked(i: u32) -> char { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an explicit #[unstable]
annotation to this function? It should have its own feature name as well.
@bors: r- Just wanna make sure that new public API surface area is documented with |
s/unsafe/unstable/ |
@alexcrichton |
/// Converts a `u32` to an `char`, not checking whether it is a valid unicode | ||
/// codepoint. | ||
#[inline] | ||
#[unstable(feature = "char_from_unchecked")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a reason
here along the lines of reason = "recently added API"
? Helps us keep track as to why it's unstable.
@alexcrichton |
⌛ Testing commit c2fca7c with merge 948cfb9... |
💔 Test failed - auto-linux-32-nopt-t |
@bors: retry On Fri, Jul 24, 2015 at 7:17 AM, bors [email protected] wrote:
|
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`. This builds upon #27233.
No description provided.