-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Audit integer types in libunicode, libcore/(char, str) and libstd/ascii #22339
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? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -119,16 +119,16 @@ pub fn from_u32(i: u32) -> Option<char> { | |||
/// ``` | |||
#[inline] | |||
#[unstable(feature = "core", reason = "pending integer conventions")] | |||
pub fn from_digit(num: uint, radix: uint) -> Option<char> { | |||
pub fn from_digit(num: u32, radix: u32) -> Option<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.
radix could be as small as u8
here.
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.
See the guideline here #22240
Actually u32
here is not as arbitrary as it may seem, radixes, for example, are directly tied to the textual representation of numbers, and u32
can be viewed as value of unicode code point. And numeric values of unicode digits (e.g. Roman numerals) can be larger than 256 (not in this example, but in others). Regardless, I think u8
would be as good as u32
and the choice doesn't really matter in practice :)
@bors r+ b1cd Thanks! |
Some function signatures have changed, so this is a [breaking-change]. In particular, radixes and numerical values of digits are represented by `u32` now. Part of rust-lang#22240
@behnam |
No worries, @petrochenkov. I'm submitting a PR to update and will CC people who may have a comment. Thanks! |
Some function signatures have changed, so this is a [breaking-change].
In particular, radixes and numerical values of digits are represented by
u32
now.Part of #22240