Skip to content

Commit 11dc6c3

Browse files
committed
make char::is_whitespace unstably const
1 parent ecd55b1 commit 11dc6c3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

core/src/char/methods.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl char {
320320
/// '1'.is_digit(37);
321321
/// ```
322322
#[stable(feature = "rust1", since = "1.0.0")]
323-
#[rustc_const_unstable(feature = "const_char_is_digit", issue = "132241")]
323+
#[rustc_const_unstable(feature = "const_char_classify", issue = "132241")]
324324
#[inline]
325325
pub const fn is_digit(self, radix: u32) -> bool {
326326
self.to_digit(radix).is_some()
@@ -856,8 +856,9 @@ impl char {
856856
/// ```
857857
#[must_use]
858858
#[stable(feature = "rust1", since = "1.0.0")]
859+
#[rustc_const_unstable(feature = "const_char_classify", issue = "132241")]
859860
#[inline]
860-
pub fn is_whitespace(self) -> bool {
861+
pub const fn is_whitespace(self) -> bool {
861862
match self {
862863
' ' | '\x09'..='\x0d' => true,
863864
c => c > '\x7f' && unicode::White_Space(c),

core/src/unicode/unicode_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub mod white_space {
575575
0, 0, 0, 0, 0, 0, 0, 0, 0,
576576
];
577577
#[inline]
578-
pub fn lookup(c: char) -> bool {
578+
pub const fn lookup(c: char) -> bool {
579579
match c as u32 >> 8 {
580580
0 => WHITESPACE_MAP[c as usize & 0xff] & 1 != 0,
581581
22 => c as u32 == 0x1680,

0 commit comments

Comments
 (0)