-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
std: Tweak some unstable features of str
#23461
Conversation
r? @gankro (rust_highfive has picked a reviewer for you, use r? to override) |
r? @aturon |
cc #9387, but doesn't quite fix it as there is still a decision left to be made |
@bors: r+ 53f493c |
This commit clarifies some of the unstable features in the `str` module by moving them out of the blanket `core` and `collections` features. The following methods were moved to the `str_char` feature which generally encompasses decoding specific characters from a `str` and dealing with the result. It is unclear if any of these methods need to be stabilized for 1.0 and the most conservative route for now is to continue providing them but to leave them as unstable under a more specific name. * `is_char_boundary` * `char_at` * `char_range_at` * `char_at_reverse` * `char_range_at_reverse` * `slice_shift_char` The following methods were moved into the generic `unicode` feature as they are specifically enabled by the `unicode` crate itself. * `nfd_chars` * `nfkd_chars` * `nfc_chars` * `graphemes` * `grapheme_indices` * `width`
53f493c
to
aa88da6
Compare
@bors: r=aturon |
📌 Commit aa88da6 has been approved by |
break; | ||
} | ||
i = range.next; | ||
i += ch.len_utf8(); |
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.
I have to wonder whether LLVM would optimize out this operation (decoding from UTF-8 and getting the length from the result of the decoding, instead of having it as a by-product) on @Kimundi's utf8x4
semi-hypothetical replacement for char
.
This commit clarifies some of the unstable features in the `str` module by moving them out of the blanket `core` and `collections` features. The following methods were moved to the `str_char` feature which generally encompasses decoding specific characters from a `str` and dealing with the result. It is unclear if any of these methods need to be stabilized for 1.0 and the most conservative route for now is to continue providing them but to leave them as unstable under a more specific name. * `is_char_boundary` * `char_at` * `char_range_at` * `char_at_reverse` * `char_range_at_reverse` * `slice_shift_char` The following methods were moved into the generic `unicode` feature as they are specifically enabled by the `unicode` crate itself. * `nfd_chars` * `nfkd_chars` * `nfc_chars` * `graphemes` * `grapheme_indices` * `width`
This commit clarifies some of the unstable features in the
str
module bymoving them out of the blanket
core
andcollections
features.The following methods were moved to the
str_char
feature which generallyencompasses decoding specific characters from a
str
and dealing with theresult. It is unclear if any of these methods need to be stabilized for 1.0 and
the most conservative route for now is to continue providing them but to leave
them as unstable under a more specific name.
is_char_boundary
char_at
char_range_at
char_at_reverse
char_range_at_reverse
slice_shift_char
The following methods were moved into the generic
unicode
feature as they arespecifically enabled by the
unicode
crate itself.nfd_chars
nfkd_chars
nfc_chars
graphemes
grapheme_indices
width