diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-05-04 14:26:19 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-05-04 14:30:20 -0700 |
| commit | 370d31b93dba75ceac236d676d6a6df07217ff07 (patch) | |
| tree | 0971030054ef705bd5ccb817947d7be70a28beb9 /library/core/src/array/ascii.rs | |
| parent | eb7a7434215dd9d4b7cc18746ad1d0e531c25325 (diff) | |
| download | rust-370d31b93dba75ceac236d676d6a6df07217ff07.tar.gz rust-370d31b93dba75ceac236d676d6a6df07217ff07.zip | |
Constify `[u8]::is_ascii` (unstably)
UTF-8 checking in `const fn`-stabilized back in 1.63, but apparently somehow ASCII checking was never const-ified, despite being simpler.
Diffstat (limited to 'library/core/src/array/ascii.rs')
| -rw-r--r-- | library/core/src/array/ascii.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/array/ascii.rs b/library/core/src/array/ascii.rs index 6750d7c0711..a942b9e4ae3 100644 --- a/library/core/src/array/ascii.rs +++ b/library/core/src/array/ascii.rs @@ -7,7 +7,7 @@ impl<const N: usize> [u8; N] { #[unstable(feature = "ascii_char", issue = "110998")] #[must_use] #[inline] - pub fn as_ascii(&self) -> Option<&[ascii::Char; N]> { + pub const fn as_ascii(&self) -> Option<&[ascii::Char; N]> { if self.is_ascii() { // SAFETY: Just checked that it's ASCII Some(unsafe { self.as_ascii_unchecked() }) |
