Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,8 @@ Tests on various well-formedness checks, e.g. [Type-checking normal functions](h

Tests on `where` clauses. See [Where clauses | Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses).

## `whitespace`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need an explanation of why the whitespace tests are needed. It's a good place to mention that is_ascii_whitespace and is_whitespace in the standard library don't match the Rust language's definition of whitespace.


## `tests/ui/windows-subsystem/`: `#![windows_subsystem = ""]`

See [the `windows_subsystem` attribute](https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute).
Expand Down
22 changes: 22 additions & 0 deletions tests/ui/whitespace/ascii_whitespace_excludes_vertical_tab.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This test checks that split_ascii_whitespace does NOT split on
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this test is relevant to the compiler?

// vertical tab (\x0B), because the standard library uses the WhatWG
// Infra Standard definition of ASCII whitespace, which excludes
// vertical tab.
//
// See: https://github.com/rust-lang/rust-project-goals/issues/53

fn main() {
let s = "a\x0Bb";

let parts: Vec<&str> = s.split_ascii_whitespace().collect();

assert_eq!(parts.len(), 1,
"vertical tab should not be treated as ASCII whitespace");

let s2 = "a b";
let parts2: Vec<&str> = s2.split_ascii_whitespace().collect();
assert_eq!(parts2.len(), 2,
"regular space should split correctly");

}

13 changes: 13 additions & 0 deletions tests/ui/whitespace/vertical_tab_lexer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This test checks that the Rust lexer treats vertical tab (\x0B) as
// whitespace, consistent with Unicode Pattern_White_Space. Note that
// the standard library's is_ascii_whitespace does NOT include vertical
// tab, following the WhatWG Infra Standard instead.
//
// See: https://github.com/rust-lang/rust-project-goals/issues/53
Copy link
Copy Markdown
Contributor

@teor2345 teor2345 Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

Where did you get this link? It's not the Outreachy tracking issue.


fn main() {
let x = 5;
let y = 10;
let z = x + y;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since vertical tab doesn't show up in GitHub's PR review rendering, please put a comment above each line containing the whitespace.

You might want to add lines with each of the 11 permitted whitespace characters:
https://doc.rust-lang.org/reference/whitespace.html

And then some lines with the other 14 disallowed whitespace characters (the ones from this list marked White_Space, that aren't in the first list):
https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt

}
Loading