rust-lang / rust-lang/rust

An nbsp isn’t treated as whitespace but instead throws an error

Open
#118,874 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-parser D-papercut D-verbose T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

let [insert nbsp] a = 10;

I expected to see this happen: The nbsp is treated as a normal whitespace character.

Instead, this happened: Multiple errors are thrown:

Unicode character ' ' (No-Break Space) looks like ' ' (Space), but it is not: ` ` (rustc)
Syntax Error: expected expression, item or let statement (rust-analyzer)
unknown start of token: \u{a0} (rustc)
Meta

rustc --version --verbose:

rustc 1.74.0 (79e9716c9 2023-11-13)
binary: rustc
commit-hash: 79e9716c980570bfd1f666e3b16ac583f0168962
commit-date: 2023-11-13
host: aarch64-apple-darwin
release: 1.74.0
LLVM version: 17.0.4

If this is intentional, why are you doing it? What are the benefits?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by reproducing the provided Rust example and comparing the rustc and rust-analyzer diagnostics. Done means reaching an agreed behavior for a no-break space in source whitespace and confirming the example no longer produces the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.