rust-lang / rust-lang/rust-mode

Incorrect parsing of compilation-mode buffers

Open
#452 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

compilation
Dominant language
Emacs Lisp
Stars
1.3k
Forks
198
PR merge metrics
No merged PRs in 30d

Description

Related to https://github.com/syl20bnr/spacemacs/issues/15643

Description :octocat:

The wrong parts of a compilation-mode buffer are parsed for certain messages.
This isn't just aesthetics. The part highlighted in red is supposed to be the file name. The part highlighted in blue is supposed to be the location in the file.
When I click on the file name, it thinks the red portion is a file, and therefore can't find it, because the actual file is (dirname/filename\.ext):\d+ not (dirname/filename\.ext:\d+).

Reproduction guide 🪲
  • Start Emacs
  • Open a scratch buffer
  • Paste the following text:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Could not get string from shell command.
             at src/main.rs:81:14

Caused by:
   0: Broken pipe (os error 32)
             at src/main.rs:79:14
      - Failed to write buffer to stdin', src/main.rs:412:28
  • M-x compilation-mode
  • Try opening the first or second highlighted file.
Observed behaviour:

Here's an example of what I see:
Image here:
image
Notice that highlighting starts at black at at then red at src/main.rs:81 then black at : then blue at 14. When I click on the first or second highlighted files, it tries to navigate to filename:linenumber then go to the column-number.
On a minimal configuration of GNU Emacs, I see this:
image
This indicates that something in spacemacs enhances compilation-mode. I have no idea what exactly does it or how to search for it.
A minimal config of spacemacs will yield the same result, until the rust layer is added.
I also found information dealing with compilation-mode in rust-compile.el therefore I assume this bug is in this package.
image

Expected behaviour:

Same thing as above, except the text should be highlighted as follows.
Start red highlight at src/main.rs then black at : then blue after the first colon and navigate to the correct file and go to the correct line number.

Contributor guide

No contributing guide indexed for this repository

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 highlighted file and location parsing in an Emacs compilation-mode buffer, comparing minimal GNU Emacs with Spacemacs and the rust layer. Read rust-compile.el and trace the compilation-mode integration that changes the highlighting. Done means the filename ends before the colon, the line and column are identified separately, and clicking navigates to the correct location.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.