Skip to content

Stabilize char::is_case_ignorable, char::is_cased, and the titlecase feature - #165434

Merged
rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
Jules-Bertholet:case-stabilizations
Nov 23, 2026
Merged

rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
Jules-Bertholet:case-stabilizations

Conversation

@Jules-Bertholet

@Jules-Bertholet Jules-Bertholet commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

is_case_ignorable() is tracked in #154848, while is_cased() and titlecase are from #153892. char::case() and char::CharCase are excluded.

API summary

// core

impl char {
    pub fn is_cased(self) -> bool;
    pub fn is_case_ignorable(self) -> bool;
    pub fn is_titlecase(self) -> bool;
    pub fn to_titlecase(self) -> ToTitlecase;
}

mod char {
    struct ToTitlecase { ... }
    impl Iterator for ToTitlecase { ... }
    impl DoubleEndedIterator for ToTitlecase { ... }
    impl FusedIterator for ToTitlecase { }
    impl ExactSizeIterator for ToTitlecase { ... }
    impl fmt::Display for ToTitlecase { ... }
}

Together, these provide all the Unicode data necessary to implement string lowercasing, as needed by crates like https://github.com/VoidStarKat/widestring-rs.


Closes #154848

@rustbot label A-Unicode T-libs I-libs-nominated needs-fcp

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 3, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Nov 3, 2026
@rustbot

rustbot commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

r? @maxdexh

rustbot has assigned @maxdexh.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 38 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, maxdexh

@rustbot rustbot added A-Unicode Area: Unicode I-libs-nominated Nominated for discussion during a libs team meeting. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Nov 3, 2026
Comment thread library/core/src/char/methods.rs Resolved
@clarfonthey

Copy link
Copy Markdown
Contributor

My main concern is offering these as aggregate tables without adding the necessary simpler tables we need for this. For example, is_cased is just is_lowercase || is_uppercase || is_titlecase and the latter isn't stable.

I think the aggregate method is good since it can use a simpler lookup. I just don't like the fact that we'd be offering is_titlecase via an inefficient set operation when it's only a handful of characters to check.

@Jules-Bertholet

Jules-Bertholet commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

We used to have a dedicated table for is_cased, I removed it in #154699.

If you want me to propose is_titlecase and friends for stabilization as well, I can do that.

@clarfonthey

Copy link
Copy Markdown
Contributor

I would recommend including is_titlecase and to_titlecase in this PR alongside the other two, then I would be happy with that. I think char::case and CharCase are not as vital here and can be decided upon later.

@Jules-Bertholet Jules-Bertholet changed the title Stabilize char::is_case_ignorable and char::is_cased Stabilize char::is_case_ignorable, char::is_cased, and the titlecase feature Nov 3, 2026
@rust-log-analyzer

This comment has been minimized.

Except `char::case` and `CharCase`.
@rustbot rustbot added the A-str Area: `str` and `String` label Nov 3, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

@rfcbot merge libs

@rust-rfcbot

rust-rfcbot commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

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!

cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. and removed needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Nov 4, 2026
@clarfonthey clarfonthey removed the I-libs-nominated Nominated for discussion during a libs team meeting. label Nov 10, 2026
@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Nov 11, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@tgross35

Copy link
Copy Markdown
Member

Potential late concern: does word_to_titlecase have the best signature? Many of the usecase I can think of involve splitting (either .split_whitespace() or .graphemes()), titlecasing each word, and collecting back to a String. The current API means you're performing an allocation for each individual word.

It could be nicer to have an API like escape_debug and others that returns an iterator of chars that could be pushed into a single existing allocation, with a Display impl so you can .to_string() if you actually want a single word.

@rust-rfcbot rust-rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 21, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@maxdexh maxdexh left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some final touches

View changes since this review

Comment thread library/alloc/src/str.rs Resolved
Comment thread library/core/src/char/mod.rs Resolved
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 22, 2026
@rustbot

rustbot commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Jules-Bertholet

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 22, 2026

@maxdexh maxdexh left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7a2cc53 has been tentatively approved by maxdexh

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 22, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 22, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #165720 (windows: remove redundant prefix parsing in `PathBuf::_push`)
 - #166243 (Avoid terminator: None in check_enums in `split_block`)
 - #165434 (Stabilize `char::is_case_ignorable`, `char::is_cased`, and the `titlecase` feature)
 - #166144 (Rc/Arc::ptr_eq ignore the metadata of all wide pointers)
@rust-bors
rust-bors Bot merged commit 16a07f9 into rust-lang:main Nov 23, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 23, 2026
Rollup merge of #165434 - Jules-Bertholet:case-stabilizations, r=maxdexh

Stabilize `char::is_case_ignorable`, `char::is_cased`, and the `titlecase` feature

`is_case_ignorable()` is tracked in #154848, while `is_cased()` and `titlecase` are from #153892. `char::case()` and `char::CharCase` are excluded.

## API summary

```rust
// core

impl char {
    pub fn is_cased(self) -> bool;
    pub fn is_case_ignorable(self) -> bool;
    pub fn is_titlecase(self) -> bool;
    pub fn to_titlecase(self) -> ToTitlecase;
}

mod char {
    struct ToTitlecase { ... }
    impl Iterator for ToTitlecase { ... }
    impl DoubleEndedIterator for ToTitlecase { ... }
    impl FusedIterator for ToTitlecase { }
    impl ExactSizeIterator for ToTitlecase { ... }
    impl fmt::Display for ToTitlecase { ... }
}
```

Together, these provide all the Unicode data necessary to implement string lowercasing, as needed by crates like https://github.com/VoidStarKat/widestring-rs.

---

Closes #154848

@rustbot label A-Unicode T-libs I-libs-nominated needs-fcp
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Nov 23, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#165720 (windows: remove redundant prefix parsing in `PathBuf::_push`)
 - rust-lang/rust#166243 (Avoid terminator: None in check_enums in `split_block`)
 - rust-lang/rust#165434 (Stabilize `char::is_case_ignorable`, `char::is_cased`, and the `titlecase` feature)
 - rust-lang/rust#166144 (Rc/Arc::ptr_eq ignore the metadata of all wide pointers)
github-merge-queue Bot pushed a commit to rust-lang/miri that referenced this pull request Nov 23, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#165720 (windows: remove redundant prefix parsing in `PathBuf::_push`)
 - rust-lang/rust#166243 (Avoid terminator: None in check_enums in `split_block`)
 - rust-lang/rust#165434 (Stabilize `char::is_case_ignorable`, `char::is_cased`, and the `titlecase` feature)
 - rust-lang/rust#166144 (Rc/Arc::ptr_eq ignore the metadata of all wide pointers)
@Jules-Bertholet
Jules-Bertholet deleted the case-stabilizations branch November 23, 2026 14:04
Comment on lines 825 to 828
#[must_use]
#[unstable(feature = "titlecase", issue = "153892")]
#[stable(feature = "cased", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub fn is_cased(self) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was a new feature created specifically for this function?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably it's a bit weird to have a feature at all for some libs APIs, but, 🤷🏻

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is from when I originally intended to stabilize only this method, without the rest of the titlecase feature. I can change it back if you would like

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was what the method had before it should be kept so that people know it was stabilised.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35 tgross35 mentioned this pull request Nov 23, 2026
2 of 4 tasks
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 26, 2026
…dexh

Correct feature name for `is_cased()` method

I accidentally changed it when stabilizing: rust-lang#165434 (comment)
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 27, 2026
…dexh

Correct feature name for `is_cased()` method

I accidentally changed it when stabilizing: rust-lang#165434 (comment)
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup merge of #166623 - Jules-Bertholet:fix-feature, r=maxdexh

Correct feature name for `is_cased()` method

I accidentally changed it when stabilizing: #165434 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-str Area: `str` and `String` A-Unicode Area: Unicode disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue for case_ignorable

7 participants