Rollup merge of #130713 - bjoernager:const-char-make-ascii, r=Noratrieb

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`.
This commit is contained in:
Matthias Krüger 2024-09-23 06:45:35 +02:00 committed by GitHub
commit 8bb69b1861
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -1279,7 +1279,7 @@ pub const fn eq_ignore_ascii_case(&self, other: &char) -> bool {
///
/// [`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();
@ -1305,7 +1305,7 @@ pub const fn make_ascii_uppercase(&mut self) {
///
/// [`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();

View File

@ -624,8 +624,9 @@ pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool {
///
/// [`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();
}
@ -649,8 +650,9 @@ pub fn make_ascii_uppercase(&mut self) {
///
/// [`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();
}