Add APIs for case folding to the standard library#154742
Add APIs for case folding to the standard library#154742Jules-Bertholet wants to merge 5 commits into
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged.
If you want to modify |
|
r? @scottmcm rustbot has assigned @scottmcm. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
5b5e617 to
bf4ee7c
Compare
|
@rustbot reroll |
This comment has been minimized.
This comment has been minimized.
bf4ee7c to
f504859
Compare
This comment has been minimized.
This comment has been minimized.
f504859 to
b0d7515
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
With an unoptimized, non-`const` implementation for now.
b0d7515 to
66b91bd
Compare
dd25c4f to
b14b43b
Compare
|
LGTM. |
This comment has been minimized.
This comment has been minimized.
|
r? libs-api |
|
I don't mind, but any particular reason for the reassign? I thought it was good to go. |
|
The API needs libs-API approval, I believe. They expressed interest in something like this, but there was never an ACP. (I also need to add a tracking issue after I get that) |
|
Figure the easiest way to get a decision on this would be to just nominate it for a meeting, but a few notes here:
So, Jules, if you'd like to write up a bit more on the motivation behind this + the situation and put that in an ACP, that would probably be easiest to review, but otherwise it feels more just like something needs to be decided on this. Basically, it ultimately boils down to whether case-folding is too niche to include in the standard library. I think that the main benefit is so that the case-folding tables can de deduplicated across crates that need them, but that's just a vague vibe-check and no idea how many people want this in practice. |
|
@clarfonthey Again, this PR is a response to a request from libs-API, who wanted to see if this could be done with low implementation burden. So I don't think I'm in the best position to speak to the broader motivation for why case folding is useful. What I can speak to is the practical considerations of putting it in the standard library. On that front, I see one major argument in favor, and one against:
|
|
Based upon my interpretation of the comment, I saw it as libs-api being more comfortable adding an API like this, but since there still needs to be libs-api approval on this specific flavour of API, just doing it at the next meeting (probably in a week, since this week is rust week) is the easiest way to get approval. There's loads of bikeshedding we could do on e.g. the name, but I figure that's something that can be figured out later, it's really more about whether the team is comfortable committing to the way this is done right now. |
View all comments
Libs-api requested these, so here they are.
New public API (gated behind
#[feature(casefold)]):Notes
core::unicode. To accomplish that, we compute the case-folding for most characters as the lowercase of their uppercase; this double mapping adds some complexity to the implementation.eq_ignore_case(); there may be a more performant implementation.char::eq_ignore_case()is left to future work—it's a potential footgun, so we may want to think more deeply about how to expose and document that API.@rustbot label T-libs-api A-unicode