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.
This commit is contained in:
Dylan MacKenzie 2020-02-08 21:27:13 -08:00
parent a29424a226
commit f6d4720f26

View file

@ -4300,8 +4300,9 @@ impl u8 {
/// assert!(!non_ascii.is_ascii());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.43.0")]
#[inline]
pub fn is_ascii(&self) -> bool {
pub const fn is_ascii(&self) -> bool {
*self & 128 == 0
}