From 75c92e7316d9442d680ea143bbede050f7f522e3 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Tue, 3 Nov 2026 15:27:06 -0500 Subject: [PATCH 01/13] Stabilize `char::is_case_ignorable` and `char::is_cased` --- library/alloc/src/lib.rs | 1 - library/core/src/char/methods.rs | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 92fa5fdb1f1ec..10b9f02128518 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -99,7 +99,6 @@ #![feature(byte_str)] #![feature(byte_str_internals)] #![feature(can_vector)] -#![feature(case_ignorable)] #![feature(cast_maybe_uninit)] #![feature(cell_get_cloned)] #![feature(char_internals)] diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 2a7b088070bd6..657872af759e5 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -818,13 +818,12 @@ impl char { /// Basic usage: /// /// ``` - /// #![feature(titlecase)] /// assert!('A'.is_cased()); /// assert!('a'.is_cased()); /// assert!(!'京'.is_cased()); /// ``` #[must_use] - #[unstable(feature = "titlecase", issue = "153892")] + #[stable(feature = "cased", since = "CURRENT_RUSTC_VERSION")] #[inline] pub fn is_cased(self) -> bool { match self { @@ -1370,7 +1369,7 @@ impl char { /// [`to_lowercase()`]: Self::to_lowercase() #[must_use] #[inline] - #[unstable(feature = "case_ignorable", issue = "154848")] + #[stable(feature = "case_ignorable", since = "CURRENT_RUSTC_VERSION")] pub fn is_case_ignorable(self) -> bool { if self.is_ascii() { matches!(self, '\'' | '.' | ':' | '^' | '`') From 8e5ad5760b1046166264a08ad993c1cd942e99be Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Tue, 3 Nov 2026 16:26:58 -0500 Subject: [PATCH 02/13] Add examples for `is_case_ignorable` --- library/core/src/char/methods.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 657872af759e5..52027693289cc 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -1367,6 +1367,21 @@ impl char { /// [specified]: https://www.unicode.org/reports/tr44/#Case_Ignorable /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt /// [`to_lowercase()`]: Self::to_lowercase() + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// assert!('.'.is_case_ignorable()); + /// assert!('\u{AD}'.is_case_ignorable()); // SOFT HYPHEN + /// assert!('ʰ'.is_case_ignorable()); // MODIFIER LETTER SMALL H + /// assert!('\u{0300}'.is_case_ignorable()); // COMBINING GRAVE ACCENT + /// assert!('\u{0345}'.is_case_ignorable()); // COMBINING GREEK YPOGEGRAMMENI + /// assert!(!'a'.is_case_ignorable()); + /// assert!(!' '.is_case_ignorable()); + /// assert!(!';'.is_case_ignorable()); + /// ``` #[must_use] #[inline] #[stable(feature = "case_ignorable", since = "CURRENT_RUSTC_VERSION")] From e9071772b98353356cbb554d2db6292717d37ddb Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Tue, 3 Nov 2026 18:13:27 -0500 Subject: [PATCH 03/13] Stabilize `titlecase` Except `char::case` and `CharCase`. --- compiler/rustc_lint/src/lib.rs | 2 +- library/alloc/src/lib.rs | 1 - library/alloc/src/str.rs | 8 +------- library/alloctests/tests/lib.rs | 1 - library/core/src/char/methods.rs | 15 ++++----------- library/core/src/char/mod.rs | 12 ++++++------ library/coretests/tests/lib.rs | 2 +- 7 files changed, 13 insertions(+), 28 deletions(-) diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 97c500ba74cee..3ee90408701c2 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -20,11 +20,11 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(titlecase))] #![feature(default_field_values)] #![feature(deref_patterns)] #![feature(iter_order_by)] #![feature(option_into_flat_iter)] -#![feature(titlecase)] #![feature(try_blocks)] // tidy-alphabetical-end diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 10b9f02128518..b690128e03794 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -173,7 +173,6 @@ #![feature(slice_range)] #![feature(std_internals)] #![feature(temporary_niche_types)] -#![feature(titlecase)] #![feature(transmutability)] #![feature(trivial_clone)] #![feature(trusted_fused)] diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs index 7997e0c053dc9..548c692f5dbb8 100644 --- a/library/alloc/src/str.rs +++ b/library/alloc/src/str.rs @@ -515,7 +515,6 @@ impl str { /// Basic usage: /// /// ``` - /// #![feature(titlecase)] /// let s = "HELLO WORLD"; /// /// assert_eq!("Hello world", s.word_to_titlecase()); @@ -524,7 +523,6 @@ impl str { /// The first *cased* letter is uppercased: /// /// ``` - /// #![feature(titlecase)] /// let the_night_before_christmas = "'twas"; /// /// assert_eq!("'Twas", the_night_before_christmas.word_to_titlecase()); @@ -533,7 +531,6 @@ impl str { /// Languages without case are not changed: /// /// ``` - /// #![feature(titlecase)] /// let new_year = "农历新年"; /// /// assert_eq!(new_year, new_year.word_to_titlecase()); @@ -542,7 +539,6 @@ impl str { /// Georgian uppercase ("Mtavruli") letters are not used in titlecase: /// /// ``` - /// #![feature(titlecase)] /// let georgian = "ერთობაშია"; /// /// assert_eq!(georgian, georgian.word_to_titlecase()); @@ -552,7 +548,6 @@ impl str { /// so only the first cased letter in the whole string gets uppercased: /// /// ``` - /// #![feature(titlecase)] /// let blazingly_fast = "ferris and I"; /// /// assert_eq!("Ferris and i", blazingly_fast.word_to_titlecase()); @@ -561,7 +556,6 @@ impl str { /// Tricky examples, with sigma: /// /// ``` - /// #![feature(titlecase)] /// let odysseus = "ὈΔΥΣΣΕΎΣ"; /// /// assert_eq!("Ὀδυσσεύς", odysseus.word_to_titlecase()); @@ -574,7 +568,7 @@ impl str { #[rustc_allow_incoherent_impl] #[must_use = "this returns the titlecase word as a new String, \ without modifying the original"] - #[unstable(feature = "titlecase", issue = "153892")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] pub fn word_to_titlecase(&self) -> String { let mut s = String::with_capacity(self.len()); let mut chars = self.char_indices(); diff --git a/library/alloctests/tests/lib.rs b/library/alloctests/tests/lib.rs index d20ae3441707a..bab67f0f90792 100644 --- a/library/alloctests/tests/lib.rs +++ b/library/alloctests/tests/lib.rs @@ -51,7 +51,6 @@ #![feature(string_replace_in_place)] #![feature(test)] #![feature(thin_box)] -#![feature(titlecase)] #![feature(trusted_len)] #![feature(try_reserve_kind)] #![feature(try_with_capacity)] diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 52027693289cc..eaca25749db9d 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -842,7 +842,7 @@ impl char { /// # Examples /// /// ``` - /// #![feature(titlecase)] + /// #![feature(char_case)] /// use core::char::CharCase; /// assert_eq!('a'.case(), Some(CharCase::Lower)); /// assert_eq!('δ'.case(), Some(CharCase::Lower)); @@ -852,7 +852,7 @@ impl char { /// assert_eq!('中'.case(), None); /// ``` #[must_use] - #[unstable(feature = "titlecase", issue = "153892")] + #[unstable(feature = "char_case", issue = "153892")] #[inline] pub fn case(self) -> Option { match self { @@ -924,7 +924,6 @@ impl char { /// Basic usage: /// /// ``` - /// #![feature(titlecase)] /// assert!('Dž'.is_titlecase()); /// assert!('ῼ'.is_titlecase()); /// assert!(!'D'.is_titlecase()); @@ -933,7 +932,7 @@ impl char { /// assert!(!' '.is_titlecase()); /// ``` #[must_use] - #[unstable(feature = "titlecase", issue = "153892")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] #[inline] pub fn is_titlecase(self) -> bool { match self { @@ -1550,7 +1549,6 @@ impl char { /// As an iterator: /// /// ``` - /// #![feature(titlecase)] /// for c in 'ß'.to_titlecase() { /// print!("{c}"); /// } @@ -1560,7 +1558,6 @@ impl char { /// Using `println!` directly: /// /// ``` - /// #![feature(titlecase)] /// println!("{}", 'ß'.to_titlecase()); /// ``` /// @@ -1573,7 +1570,6 @@ impl char { /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string): /// /// ``` - /// #![feature(titlecase)] /// assert_eq!('c'.to_titlecase().to_string(), "C"); /// assert_eq!('ა'.to_titlecase().to_string(), "ა"); /// assert_eq!('dž'.to_titlecase().to_string(), "Dž"); @@ -1603,7 +1599,6 @@ impl char { /// will return the mtavruli form, but `to_titlecase()` will return the mkhedruli form. /// /// ``` - /// #![feature(titlecase)] /// let ani = 'ა'; // First letter of the Georgian alphabet, in mkhedruli form /// /// // Titlecasing mkhedruli maps it to itself... @@ -1667,7 +1662,6 @@ impl char { /// Note that the lowercase dotted 'i' is the same codepoint as the Latin. Therefore: /// /// ``` - /// #![feature(titlecase)] /// let upper_i = 'i'.to_titlecase().to_string(); /// ``` /// @@ -1676,7 +1670,6 @@ impl char { /// be `"İ"`. `to_titlecase()` does not take this into account, and so: /// /// ``` - /// #![feature(titlecase)] /// let upper_i = 'i'.to_titlecase().to_string(); /// /// assert_eq!(upper_i, "I"); @@ -1687,7 +1680,7 @@ impl char { /// [`to_uppercase()`]: Self::to_uppercase() #[must_use = "this returns the titlecased character as a new iterator, \ without modifying the original"] - #[unstable(feature = "titlecase", issue = "153892")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] #[inline] pub fn to_titlecase(self) -> ToTitlecase { ToTitlecase(CaseMappingIter::new(conversions::to_title(self))) diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs index 28bd0929c1141..4267930817fe4 100644 --- a/library/core/src/char/mod.rs +++ b/library/core/src/char/mod.rs @@ -490,11 +490,11 @@ casemappingiter_impls! { } casemappingiter_impls! { - #[unstable(feature = "titlecase", issue = "153892")] - #[unstable(feature = "titlecase", issue = "153892")] - #[unstable(feature = "titlecase", issue = "153892")] - #[unstable(feature = "titlecase", issue = "153892")] - #[unstable(feature = "titlecase", issue = "153892")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] /// Returns an iterator that yields the titlecase equivalent of a `char`. /// /// This `struct` is created by the [`to_titlecase`] method on [`char`]. See @@ -664,7 +664,7 @@ impl Error for TryFromCharError {} /// the most significant bit represents whether the case /// conceptually starts as uppercase, while the least significant bit /// represents whether it conceptually ends as uppercase. -#[unstable(feature = "titlecase", issue = "153892")] +#[unstable(feature = "char_case", issue = "153892")] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum CharCase { /// Lowercase. Corresponds to the `Lowercase` Unicode property. diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index 4e1b1a1aa6f6e..e826fcfc020e5 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -16,6 +16,7 @@ #![feature(casefold)] #![feature(cfg_overflow_checks)] #![feature(cfg_target_has_reliable_f16_f128)] +#![feature(char_case)] #![feature(char_internals)] #![feature(char_is_xid)] #![feature(clamp_magnitude)] @@ -121,7 +122,6 @@ #![feature(step_trait)] #![feature(str_internals)] #![feature(strict_provenance_lints)] -#![feature(titlecase)] #![feature(trusted_len)] #![feature(trusted_random_access)] #![feature(try_blocks)] From 8d255142a85339b04476840b74ba811eba3435b9 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 9 Nov 2026 01:20:19 +0100 Subject: [PATCH 04/13] rename comps to self_comps since we'll introduce another comps in the next commit. --- library/std/src/path.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 4eb3796ac026d..1e4d43eaa22fd 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1345,11 +1345,11 @@ impl PathBuf { let mut need_sep = buf.last().map(|c| !is_sep_byte(*c)).unwrap_or(false); // in the special case of `C:` on Windows, do *not* add a separator - let comps = self.components(); + let self_comps = self.components(); - if comps.prefix_len() > 0 - && comps.prefix_len() == comps.path.len() - && comps.prefix.unwrap().is_drive() + if self_comps.prefix_len() > 0 + && self_comps.prefix_len() == self_comps.path.len() + && self_comps.prefix.unwrap().is_drive() { need_sep = false } @@ -1368,8 +1368,8 @@ impl PathBuf { self.inner.clear(); // verbatim paths need . and .. removed - } else if comps.prefix_verbatim() && !path.inner.is_empty() { - let mut buf: Vec<_> = comps.collect(); + } else if self_comps.prefix_verbatim() && !path.inner.is_empty() { + let mut buf: Vec<_> = self_comps.collect(); for c in path.components() { match c { Component::RootDir => { From 64b7a13b201faab463741788d48d9d0746e3f5a1 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 9 Nov 2026 00:42:39 +0100 Subject: [PATCH 05/13] create `Components` for the pushed path only once `components()` does non-trivial prefix-checking work on Windows. --- library/std/src/path.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 1e4d43eaa22fd..3dd4cee039a18 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1354,13 +1354,15 @@ impl PathBuf { need_sep = false } + let path_comps = path.components(); + let need_clear = if cfg!(target_os = "cygwin") { // If path is absolute and its prefix is none, it is like `/foo`, // and will be handled below. - path.prefix().is_some() + path_comps.prefix.is_some() } else { // On Unix: prefix is always None. - path.is_absolute() || path.prefix().is_some() + path.is_absolute() || path_comps.prefix.is_some() }; // absolute `path` replaces `self` @@ -1370,7 +1372,7 @@ impl PathBuf { // verbatim paths need . and .. removed } else if self_comps.prefix_verbatim() && !path.inner.is_empty() { let mut buf: Vec<_> = self_comps.collect(); - for c in path.components() { + for c in path_comps { match c { Component::RootDir => { buf.truncate(1); @@ -1408,7 +1410,7 @@ impl PathBuf { return; // `path` has a root but no prefix, e.g., `\windows` (Windows only) - } else if path.has_root() { + } else if path_comps.has_root() { let prefix_len = self.components().prefix_remaining(); self.inner.truncate(prefix_len); From 2e6050843a4bffb46378896bab1ac6c1f2dc5e14 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 9 Nov 2026 00:42:44 +0100 Subject: [PATCH 06/13] reuse prefix length of self instead of re-deriving it Saves another round of prefix parsing. `self_comps` hasn't iterated, so `prefix_remaining` is always the same as `prefix_len`. --- library/std/src/path.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 3dd4cee039a18..2f0f88ac722e5 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1344,11 +1344,12 @@ impl PathBuf { let buf = self.inner.as_encoded_bytes(); let mut need_sep = buf.last().map(|c| !is_sep_byte(*c)).unwrap_or(false); - // in the special case of `C:` on Windows, do *not* add a separator let self_comps = self.components(); + let self_prefix_len = self_comps.prefix_len(); - if self_comps.prefix_len() > 0 - && self_comps.prefix_len() == self_comps.path.len() + // in the special case of `C:` on Windows, do *not* add a separator + if self_prefix_len > 0 + && self_prefix_len == self_comps.path.len() && self_comps.prefix.unwrap().is_drive() { need_sep = false @@ -1411,8 +1412,7 @@ impl PathBuf { // `path` has a root but no prefix, e.g., `\windows` (Windows only) } else if path_comps.has_root() { - let prefix_len = self.components().prefix_remaining(); - self.inner.truncate(prefix_len); + self.inner.truncate(self_prefix_len); // `path` is a pure relative path } else if need_sep { From 1c5a731ebef2d859970d2e8d72e14f83cc8d6a43 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 9 Nov 2026 00:48:59 +0100 Subject: [PATCH 07/13] skip extra `is_absolute` check on Windows `is_absolute` causes another two prefix re-parsings, once each in `Path::has_root` and `Path::prefix`, but it's unnecessary: `path.is_absolute() || path_comps.prefix.is_some()` expands to `(path.has_root() && path.prefix().is_some()) || path_comps.prefix.is_some()`, which simplifies to just the prefix check. Pushing `C:foo` should clear, pushing `\foo` truncates to the existing prefix, just like on cygwin. --- library/std/src/path.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 2f0f88ac722e5..b9aa351d69ae2 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1357,9 +1357,9 @@ impl PathBuf { let path_comps = path.components(); - let need_clear = if cfg!(target_os = "cygwin") { - // If path is absolute and its prefix is none, it is like `/foo`, - // and will be handled below. + let need_clear = if cfg!(any(target_os = "windows", target_os = "cygwin")) { + // Windows/Cygwin: If path is absolute and its prefix is none, it is like `\foo` + // (Windows) or `/foo` (Cygwin), and will be handled below. path_comps.prefix.is_some() } else { // On Unix: prefix is always None. From aa90b4f7a83e595e4cfe421deebb33d318d55cd1 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Mon, 9 Nov 2026 00:42:53 +0100 Subject: [PATCH 08/13] simplify separator logic for verbatim paths Both prefix checks are always true: - `!prefix.parsed.is_drive()` - We are in the branch that already checked `comps.prefix_verbatim()`. Verbatim prefixes are never `Prefix::Disk`. - The pushed path can't have a prefix, since that would mean `need_clear` was true, at which point we wouldn't have to deal with merging verbatim paths in the first place :) - `prefix.parsed.len() > 0`: prefixes are nonempty, and we're already in the `comps.prefix_verbatim()` branch. --- library/std/src/path.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index b9aa351d69ae2..2f33c5c2e8087 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1397,14 +1397,7 @@ impl PathBuf { res.push(MAIN_SEPARATOR_STR); } res.push(c.as_os_str()); - - need_sep = match c { - Component::RootDir => false, - Component::Prefix(prefix) => { - !prefix.parsed.is_drive() && prefix.parsed.len() > 0 - } - _ => true, - } + need_sep = c != Component::RootDir; } self.inner = res; From 88a39ff37fd2cbe8ff688b60920c5b07e1758857 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Mon, 16 Nov 2026 10:04:38 -0500 Subject: [PATCH 09/13] Don't stabilize `str::word_to_titlecase` --- library/alloc/src/str.rs | 8 +++++++- library/alloctests/tests/lib.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs index 548c692f5dbb8..5a438e6991db3 100644 --- a/library/alloc/src/str.rs +++ b/library/alloc/src/str.rs @@ -515,6 +515,7 @@ impl str { /// Basic usage: /// /// ``` + /// #![feature(word_to_titlecase)] /// let s = "HELLO WORLD"; /// /// assert_eq!("Hello world", s.word_to_titlecase()); @@ -523,6 +524,7 @@ impl str { /// The first *cased* letter is uppercased: /// /// ``` + /// #![feature(word_to_titlecase)] /// let the_night_before_christmas = "'twas"; /// /// assert_eq!("'Twas", the_night_before_christmas.word_to_titlecase()); @@ -531,6 +533,7 @@ impl str { /// Languages without case are not changed: /// /// ``` + /// #![feature(word_to_titlecase)] /// let new_year = "农历新年"; /// /// assert_eq!(new_year, new_year.word_to_titlecase()); @@ -539,6 +542,7 @@ impl str { /// Georgian uppercase ("Mtavruli") letters are not used in titlecase: /// /// ``` + /// #![feature(word_to_titlecase)] /// let georgian = "ერთობაშია"; /// /// assert_eq!(georgian, georgian.word_to_titlecase()); @@ -548,6 +552,7 @@ impl str { /// so only the first cased letter in the whole string gets uppercased: /// /// ``` + /// #![feature(word_to_titlecase)] /// let blazingly_fast = "ferris and I"; /// /// assert_eq!("Ferris and i", blazingly_fast.word_to_titlecase()); @@ -556,6 +561,7 @@ impl str { /// Tricky examples, with sigma: /// /// ``` + /// #![feature(word_to_titlecase)] /// let odysseus = "ὈΔΥΣΣΕΎΣ"; /// /// assert_eq!("Ὀδυσσεύς", odysseus.word_to_titlecase()); @@ -568,7 +574,7 @@ impl str { #[rustc_allow_incoherent_impl] #[must_use = "this returns the titlecase word as a new String, \ without modifying the original"] - #[stable(feature = "titlecase", since = "CURRENT_RUSTC_VERSION")] + #[unstable(feature = "word_to_titlecase", issue = "153892")] pub fn word_to_titlecase(&self) -> String { let mut s = String::with_capacity(self.len()); let mut chars = self.char_indices(); diff --git a/library/alloctests/tests/lib.rs b/library/alloctests/tests/lib.rs index bab67f0f90792..a81c8012b7587 100644 --- a/library/alloctests/tests/lib.rs +++ b/library/alloctests/tests/lib.rs @@ -58,6 +58,7 @@ #![feature(unique_rc_arc)] #![feature(vec_deque_retain_range)] #![feature(vec_peek_mut)] +#![feature(word_to_titlecase)] #![feature(write_all_vectored)] // tidy-alphabetical-end From 30c1bb516bbac6ce397fe892fa45db5d52578ff8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 18 Nov 2026 10:43:12 +0100 Subject: [PATCH 10/13] Rc/Arc::ptr_eq ignore the metadata of all wide pointers --- library/alloc/src/rcs/arc.rs | 6 +++--- library/alloc/src/rcs/rc.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/alloc/src/rcs/arc.rs b/library/alloc/src/rcs/arc.rs index b76001e55ae65..53f50ad7267cf 100644 --- a/library/alloc/src/rcs/arc.rs +++ b/library/alloc/src/rcs/arc.rs @@ -2247,7 +2247,7 @@ impl Arc { } /// Returns `true` if the two `Arc`s point to the same allocation in a vein similar to - /// [`ptr::eq`]. This function ignores the metadata of `dyn Trait` pointers. + /// [`ptr::addr_eq`]. This function ignores the metadata of wide pointers. /// /// # Examples /// @@ -3522,9 +3522,9 @@ impl Weak { } } - /// Returns `true` if the two `Weak`s point to the same allocation similar to [`ptr::eq`], or if + /// Returns `true` if the two `Weak`s point to the same allocation similar to [`ptr::addr_eq`], or if /// both don't point to any allocation (because they were created with `Weak::new()`). However, - /// this function ignores the metadata of `dyn Trait` pointers. + /// this function ignores the metadata of wide pointers. /// /// # Notes /// diff --git a/library/alloc/src/rcs/rc.rs b/library/alloc/src/rcs/rc.rs index 1874441f3f920..bb9587e03f805 100644 --- a/library/alloc/src/rcs/rc.rs +++ b/library/alloc/src/rcs/rc.rs @@ -2153,7 +2153,7 @@ impl Rc { #[inline] #[stable(feature = "ptr_eq", since = "1.17.0")] /// Returns `true` if the two `Rc`s point to the same allocation in a vein similar to - /// [`ptr::eq`]. This function ignores the metadata of `dyn Trait` pointers. + /// [`ptr::addr_eq`]. This function ignores the metadata of wide pointers. /// /// # Examples /// @@ -3773,9 +3773,9 @@ impl Weak { } } - /// Returns `true` if the two `Weak`s point to the same allocation similar to [`ptr::eq`], or if + /// Returns `true` if the two `Weak`s point to the same allocation similar to [`ptr::addr_eq`], or if /// both don't point to any allocation (because they were created with `Weak::new()`). However, - /// this function ignores the metadata of `dyn Trait` pointers. + /// this function ignores the metadata of wide pointers. /// /// # Notes /// From bc8dbd49f419c2bfbbf1b6e26fb8e244660938e3 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Sun, 22 Nov 2026 15:52:40 +0100 Subject: [PATCH 11/13] uefi targets don't call prefix() anymore now that the prefix() helper method isn't used in `_push` anymore, there are no callers left in the uefi builds. --- library/std/src/path.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 2f33c5c2e8087..9703d41009f9c 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2570,6 +2570,7 @@ impl Path { !self.is_absolute() } + #[cfg(not(target_os = "uefi"))] pub(crate) fn prefix(&self) -> Option> { self.components().prefix } From 7a2cc535cd3d6c25eab35a4401c8e4c4accdc22f Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Sun, 22 Nov 2026 11:57:19 -0500 Subject: [PATCH 12/13] Update tracking issues --- library/alloc/src/str.rs | 2 +- library/core/src/char/methods.rs | 2 +- library/core/src/char/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs index 5a438e6991db3..e5f332fe72f11 100644 --- a/library/alloc/src/str.rs +++ b/library/alloc/src/str.rs @@ -574,7 +574,7 @@ impl str { #[rustc_allow_incoherent_impl] #[must_use = "this returns the titlecase word as a new String, \ without modifying the original"] - #[unstable(feature = "word_to_titlecase", issue = "153892")] + #[unstable(feature = "word_to_titlecase", issue = "166361")] pub fn word_to_titlecase(&self) -> String { let mut s = String::with_capacity(self.len()); let mut chars = self.char_indices(); diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index eaca25749db9d..bb80e27edc927 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -852,7 +852,7 @@ impl char { /// assert_eq!('中'.case(), None); /// ``` #[must_use] - #[unstable(feature = "char_case", issue = "153892")] + #[unstable(feature = "char_case", issue = "166360")] #[inline] pub fn case(self) -> Option { match self { diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs index 4267930817fe4..872161dca22e8 100644 --- a/library/core/src/char/mod.rs +++ b/library/core/src/char/mod.rs @@ -664,7 +664,7 @@ impl Error for TryFromCharError {} /// the most significant bit represents whether the case /// conceptually starts as uppercase, while the least significant bit /// represents whether it conceptually ends as uppercase. -#[unstable(feature = "char_case", issue = "153892")] +#[unstable(feature = "char_case", issue = "166360")] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum CharCase { /// Lowercase. Corresponds to the `Lowercase` Unicode property. From 48470391b9cd1dd518a9f669cf400f0641824c94 Mon Sep 17 00:00:00 2001 From: panstromek Date: Fri, 20 Nov 2026 10:37:31 +0100 Subject: [PATCH 13/13] ref: avoid terminator: None in check_enums in `split_block` Here the simplest way to avoid it just to honor the `split_block` function name and do a proper split which inserts a goto instead of taking the terminator out. This goto will then be replaced by adding later checks. --- .../rustc_mir_transform/src/check_enums.rs | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_mir_transform/src/check_enums.rs b/compiler/rustc_mir_transform/src/check_enums.rs index 82945c8974827..72eb09663c9eb 100644 --- a/compiler/rustc_mir_transform/src/check_enums.rs +++ b/compiler/rustc_mir_transform/src/check_enums.rs @@ -47,7 +47,9 @@ impl<'tcx> crate::MirPass<'tcx> for CheckEnums { for check in finder.into_found_enums() { debug!("Inserting enum check"); - let new_block = split_block(basic_blocks, location); + // Note: this split inserts a Goto(new_block) terminator, + // which we later overwrite when we insert the check. + let new_block = split_block(basic_blocks, location, source_info); match check { EnumCheckType::Direct { op_size, .. } @@ -60,10 +62,6 @@ impl<'tcx> crate::MirPass<'tcx> for CheckEnums { source_info.span, "cannot build enum discriminant from zero-sized type", ); - basic_blocks[block].terminator = Some(Terminator { - source_info, - kind: TerminatorKind::goto(new_block), - }); } EnumCheckType::Direct { source_op, discr, op_size, valid_discrs } => { insert_direct_enum_check( @@ -240,17 +238,21 @@ impl<'a, 'tcx> Visitor<'tcx> for EnumFinder<'a, 'tcx> { fn split_block( basic_blocks: &mut IndexVec>, location: Location, + source_info: SourceInfo, ) -> BasicBlock { - let block_data = &mut basic_blocks[location.block]; + basic_blocks.push_with(|new_block_idx, basic_blocks| { + let block_data = &mut basic_blocks[location.block]; - // Drain every statement after this one and move the current terminator to a new basic block. - let new_block = BasicBlockData::maybe_unterminated_stmts( - block_data.statements.split_off(location.statement_index), - block_data.terminator.take(), - block_data.is_cleanup, - ); + // Drain every statement after this one + let remaining_stmts = block_data.statements.split_off(location.statement_index); + + // replace the old terminator with a goto to the new block + let new_terminator = Terminator { source_info, kind: TerminatorKind::goto(new_block_idx) }; + let old_terminator = std::mem::replace(block_data.terminator_mut(), new_terminator); - basic_blocks.push(new_block) + // move the old terminator to the new basic block + BasicBlockData::new_stmts(remaining_stmts, old_terminator, block_data.is_cleanup) + }) } /// Inserts the cast of an operand (any type) to a u128 value that holds the discriminant value. @@ -335,6 +337,7 @@ fn insert_discr_cast_to_u128<'tcx>( discr } +// note: This function replaces the current_block terminator. fn insert_direct_enum_check<'tcx>( tcx: TyCtxt<'tcx>, local_decls: &mut IndexVec>, @@ -418,6 +421,7 @@ fn insert_direct_enum_check<'tcx>( }); } +// Note: this function replaces the block's terminator fn insert_uninhabited_enum_check<'tcx>( tcx: TyCtxt<'tcx>, local_decls: &mut IndexVec>, @@ -463,6 +467,7 @@ fn insert_uninhabited_enum_check<'tcx>( }); } +// Note: this function replaces the block's terminator. fn insert_niche_check<'tcx>( tcx: TyCtxt<'tcx>, local_decls: &mut IndexVec>,