Support char::is_digit
in const contexts
This commit is contained in:
parent
81d6652e74
commit
66209cd9b5
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user