Skip to content

Commit f6d4720

Browse files
Make u8::is_ascii a stable const fn
`char::is_ascii` is already a stable `const fn`, so there is no reason for `u8::is_ascii` to be unstable.
1 parent a29424a commit f6d4720

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libcore/num/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4300,8 +4300,9 @@ impl u8 {
43004300
/// assert!(!non_ascii.is_ascii());
43014301
/// ```
43024302
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
4303+
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.43.0")]
43034304
#[inline]
4304-
pub fn is_ascii(&self) -> bool {
4305+
pub const fn is_ascii(&self) -> bool {
43054306
*self & 128 == 0
43064307
}
43074308

0 commit comments

Comments
 (0)