Skip to content

string continue non-ASCII whitespace confusing as \x0C is ASCII whitespace #108275

Closed
@ModProg

Description

@ModProg

Code

fn main() {
    assert!('\x0c'.is_ascii_whitespace());
    println!("Hello,\
         world!");
}

Current output

warning: non-ASCII whitespace symbol '\u{c}' is not skipped
 --> src/main.rs:3:21
  |
3 |       println!("Hello,\
  |  _____________________^
4 | |
               world!");
  | |      ^- non-ASCII whitespace symbol '\u{c}' is not skipped
  | |______|
  |

Desired output

warning: non-ASCII whitespace symbol '\u{c}' is not skipped
 --> src/main.rs:3:21
  |
3 |       println!("Hello,\
  |  _____________________^
4 | |
               world!");
  | |      ^- '\u{c}' is not skipped, only `\n`, `\r`, `\t` and ` ` are skipped
  | |______|
  |

Rationale and extra context

According to char::is_ascii_whitespace, \x0c is ASCII whitespace.

Other cases

No response

Anything else?

Not sure if this is actually an issue, just an inconsistency I found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions