diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-23 06:45:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-23 06:45:35 +0200 |
| commit | 8bb69b1861bae75fe015bb2b12a4ab1751de0101 (patch) | |
| tree | 5aa5b7a8eb95287fd937a20bce64eab7606691a8 | |
| parent | 82060368e638d07f5ea5cf4f04c0e37edb829e28 (diff) | |
| parent | 2daf076fd8345ea2db1a81f56e8182e5f4e94ce3 (diff) | |
| download | rust-8bb69b1861bae75fe015bb2b12a4ab1751de0101.tar.gz rust-8bb69b1861bae75fe015bb2b12a4ab1751de0101.zip | |
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`.
| -rw-r--r-- | library/core/src/char/methods.rs | 4 | ||||
| -rw-r--r-- | library/core/src/num/mod.rs | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 9b56db47b5c..3dcaab6a12b 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -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(); @@ -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(); diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index 19f5b79d261..31e35015d2d 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -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(); } @@ -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(); } |
