Skip to content

Commit

Permalink
Rollup merge of rust-lang#132242 - ultrabear:const_is_digit, r=scottmcm
Browse files Browse the repository at this point in the history
Support `char::is_digit` in const contexts.

This PR implements [`feature(const_char_is_digit)` rust-lang#132241](rust-lang#132241)
  • Loading branch information
jieyouxu authored Oct 28, 2024
2 parents a9ee1d0 + 66209cd commit f14637b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ impl char {
/// '1'.is_digit(37);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_char_is_digit", issue = "132241")]
#[inline]
pub fn is_digit(self, radix: u32) -> bool {
pub const fn is_digit(self, radix: u32) -> bool {
self.to_digit(radix).is_some()
}

Expand Down

0 comments on commit f14637b

Please sign in to comment.