Rollup merge of #132242 - ultrabear:const_is_digit, r=scottmcm

Support `char::is_digit` in const contexts.

This PR implements [`feature(const_char_is_digit)` #132241](https://github.com/rust-lang/rust/issues/132241)
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-28 13:36:20 +08:00 committed by GitHub
commit f14637b025
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()
}