From 66209cd9b57f9414c9b8bc826ca97c4b7d52489a Mon Sep 17 00:00:00 2001 From: ultrabear Date: Sun, 27 Oct 2024 14:31:58 -0700 Subject: [PATCH] Support `char::is_digit` in const contexts --- library/core/src/char/methods.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 9c667edb476..206bbf5690e 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -320,8 +320,9 @@ pub const fn from_digit(num: u32, radix: u32) -> Option { /// '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() }