Skip to content

Commit

Permalink
Make u8::is_ascii a stable const fn
Browse files Browse the repository at this point in the history
`char::is_ascii` is already a stable `const fn`, so there is no reason
for `u8::is_ascii` to be unstable.
  • Loading branch information
ecstatic-morse committed Feb 9, 2020
1 parent a29424a commit f6d4720
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit f6d4720

Please sign in to comment.