Skip to content

Commit

Permalink
Auto merge of rust-lang#130697 - bjoernager:const-char-make-ascii, r=…
Browse files Browse the repository at this point in the history
…dtolnay

Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const.

Relevant tracking issue: rust-lang#130698

The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const."

With the stabilisation of [`const_mut_refs`](rust-lang#57349), this simply requires adding the `const` specifier to the function signatures.
  • Loading branch information
bors committed Sep 22, 2024
2 parents d098993 + 36b115f commit 9c26e05
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,8 +1279,9 @@ impl char {
///
/// [`to_ascii_uppercase()`]: #method.to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_char_make_ascii", issue = "130698")]
#[inline]
pub fn make_ascii_uppercase(&mut self) {
pub const fn make_ascii_uppercase(&mut self) {
*self = self.to_ascii_uppercase();
}

Expand All @@ -1304,8 +1305,9 @@ impl char {
///
/// [`to_ascii_lowercase()`]: #method.to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_char_make_ascii", issue = "130698")]
#[inline]
pub fn make_ascii_lowercase(&mut self) {
pub const fn make_ascii_lowercase(&mut self) {
*self = self.to_ascii_lowercase();
}

Expand Down

0 comments on commit 9c26e05

Please sign in to comment.