Skip to content

Commit

Permalink
Rollup merge of #130713 - bjoernager:const-char-make-ascii, r=Noratrieb
Browse files Browse the repository at this point in the history
Mark `u8::make_ascii_uppercase` and `u8::make_ascii_lowercase` as const.

Relevant tracking issue: #130698

This PR extends #130697 by also marking the `make_ascii_uppercase` and `make_ascii_lowercase` methods in `u8` as const.

The `const_char_make_ascii` feature gate is additionally renamed to `const_make_ascii`.
  • Loading branch information
matthiaskrgr authored Sep 23, 2024
2 parents 8206036 + 2daf076 commit 8bb69b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ 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")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[inline]
pub const fn make_ascii_uppercase(&mut self) {
*self = self.to_ascii_uppercase();
Expand All @@ -1305,7 +1305,7 @@ 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")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[inline]
pub const fn make_ascii_lowercase(&mut self) {
*self = self.to_ascii_lowercase();
Expand Down
6 changes: 4 additions & 2 deletions library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,9 @@ impl u8 {
///
/// [`to_ascii_uppercase`]: Self::to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_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 @@ -649,8 +650,9 @@ impl u8 {
///
/// [`to_ascii_lowercase`]: Self::to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_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 8bb69b1

Please sign in to comment.