rust-lang / rust-lang/rustfmt

Regression with `wrap_comments=true`

Open
#5,862 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-comments only-with-option P-low
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Hi all,

I've noticed a regression that happened between rustfmt 1.5.2-nightly (fe7454b 2023-06-19) and rustfmt 1.5.3-nightly (4651421 2023-06-20).

In my project [1], whenever I run cargo fmt, some comment lines are mangled unexpectedly. Here's the full diff: https://pastebin.com/raw/HwqgrCUz

If I disable wrap_comments=true in rustfmt.toml, the problem no longer occurs.

Interestingly, I couldn't reproduce the problem using a small demonstration program. It only happens when using rustfmt or cargo fmt in my project (which has around 75k LoC).

This is similar to #5835, but not quite the same problem.

Please let me know if you need more info to look into this.

[1] https://github.com/rwestphal/holo

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

Start by comparing rustfmt 1.5.2-nightly with 1.5.3-nightly on the linked holo project, using its rustfmt.toml and the full diff in the Pastebin report. Focus on the behavior when wrap_comments=true and compare it with the result when that setting is disabled; done means the comment mangling is reproducible and no longer occurs.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.