mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
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:
commit
f14637b025
@ -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()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user