Support char::is_digit in const contexts

This commit is contained in:
ultrabear 2024-10-27 14:31:58 -07:00
parent 81d6652e74
commit 66209cd9b5
No known key found for this signature in database
GPG Key ID: 6A5BDAF57DFFD6A0

View File

@ -320,8 +320,9 @@ pub const fn from_digit(num: u32, radix: u32) -> Option<char> {
/// '1'.is_digit(37); /// '1'.is_digit(37);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_char_is_digit", issue = "132241")]
#[inline] #[inline]
pub fn is_digit(self, radix: u32) -> bool { pub const fn is_digit(self, radix: u32) -> bool {
self.to_digit(radix).is_some() self.to_digit(radix).is_some()
} }