diff options
| author | bors <bors@rust-lang.org> | 2024-09-22 13:55:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-22 13:55:07 +0000 |
| commit | 0af7f0f4c4bdec179f42d0db4ec322040582de9d (patch) | |
| tree | ed89d4ddf726a6d556fbab5a2b5a2916e678fc28 | |
| parent | 4ae36d906f7f509e63aaa7ea99fdbefd1463eb96 (diff) | |
| parent | be9b3b459a0012fc83078ec4e5302b6153ceeeba (diff) | |
| download | rust-0af7f0f4c4bdec179f42d0db4ec322040582de9d.tar.gz rust-0af7f0f4c4bdec179f42d0db4ec322040582de9d.zip | |
Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnay
Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const. Relevant tracking issue: #130698 The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const." With the stabilisation of [`const_mut_refs`](https://github.com/rust-lang/rust/issues/57349/), this simply requires adding the `const` specifier to the function signatures.
| -rw-r--r-- | library/core/src/char/methods.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 092d427ecea..7d64b382501 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -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(); } @@ -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(); } |
