Skip to content

Commit fe71b66

Browse files
committed
Fix comment on is_horizontal_whitespace
The comment on `is_horizontal_whitespace` says "This is Pattern_White_Space", but the function matches only tab (U+0009) and space (U+0020) -- two of the eleven `Pattern_White_Space` code points. This has been the case since Rust PR 146106, which narrowed the set from full `Pattern_White_Space` to the horizontal subset. The correct characterization is that this is the horizontal space subset of `Pattern_White_Space`, as categorized by UAX 31, Section 4.1, which partitions `Pattern_White_Space` into line endings, ignorable format controls, and horizontal space.
1 parent d933cf4 commit fe71b66

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • compiler/rustc_lexer/src

compiler/rustc_lexer/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ pub fn is_whitespace(c: char) -> bool {
367367

368368
/// True if `c` is considered horizontal whitespace according to Rust language definition.
369369
pub fn is_horizontal_whitespace(c: char) -> bool {
370-
// This is Pattern_White_Space.
370+
// This is the horizontal space subset of `Pattern_White_Space` as
371+
// categorized by UAX #31, Section 4.1.
371372
//
372373
// Note that this set is stable (ie, it doesn't change with different
373374
// Unicode versions), so it's ok to just hard-code the values.

0 commit comments

Comments
 (0)