rust-lang / rust-lang/rustfmt

error[internal]: left behind trailing whitespace (full repro with GitHub link to offending repo)

Open
#6,649 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Toolchain Version

Everything is installed using rustup.

$ cargo --version
cargo 1.89.0 (c24e10642 2025-06-23)

Observed Behavior

When running cargo fmt, I get the following errors:

error[internal]: left behind trailing whitespace
   --> /home/manish/work/hedgehog/src/dataplane/pkt-meta/src/flow_table/table.rs:371:371:1
    |
371 |                     
    | ^^^^^^^^^^^^^^^^^^^^
    |

error[internal]: left behind trailing whitespace
   --> /home/manish/work/hedgehog/src/dataplane/pkt-meta/src/flow_table/table.rs:380:380:1
    |
380 |                     
    | ^^^^^^^^^^^^^^^^^^^^
    |

Expected Behavior

cargo fmt removes the trailing whitespace without internal error.

How to Reproduce

On GitHub checkout the code from https://github.com/githedgehog/dataplane/tree/bug-report/rust-1.89/rustfmt-internal-error. After checkout, don't forget to switch to the bug-report/rust-1.89/rustfmt-internal-error branch.

Using the Rust 1.89 toolchain, run cargo fmt to reproduce the issue.

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

Check out the linked dataplane repository's bug-report/rust-1.89/rustfmt-internal-error branch and run cargo fmt with Rust 1.89. Inspect dataplane/pkt-meta/src/flow_table/table.rs at lines 371 and 380, where trailing whitespace triggers the internal errors. Done means cargo fmt removes that whitespace without reporting an internal error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.