rust-lang / rust-lang/rustfmt

Incorrect path printed on error

Open
#5,463 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

nazar-pc@nazar-pc:/w/s/subspace> rustfmt --version
rustfmt 1.5.1-nightly (62b272d 2022-07-21)
nazar-pc@nazar-pc:/w/s/subspace> rustfmt --config error_on_line_overflow=true crates/pallet-subspace/src/lib.rs
error[internal]: line formatted, but exceeded maximum width (maximum: 100 (see `max_width` option), found: 105)
   --> /web/subspace/subspace/crates/pallet-subspace/src/lib.rs:478:478:101
    |
478 |         #[pallet::weight((<T as Config>::WeightInfo::report_equivocation(), DispatchClass::Operational))]
    |                                                                                                     ^^^^^
    |

error[internal]: line formatted, but exceeded maximum width (maximum: 100 (see `max_width` option), found: 128)
   --> /web/subspace/subspace/crates/pallet-subspace/src/lib.rs:493:493:101
    |
493 |         #[pallet::weight((<T as Config>::WeightInfo::store_root_blocks(root_blocks.len()), DispatchClass::Mandatory, Pays::No))]
    |                                                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |

warning: rustfmt has failed to format. See previous 2 errors.

This is inconvenient when I want to open the file at that line in IDE afterwards.

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 reproducing the reported rustfmt command with --config error_on_line_overflow=true against crates/pallet-subspace/src/lib.rs and inspect how the diagnostic path is produced. Done means the error points to the source path that can be opened directly in an IDE while preserving the reported line and column information.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.