Rust-GCC / Rust-GCC/gccrs

Issue with column location

Open
#3,526 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

It looks like there's a slight bug with token locations in the following rust code (from #2376)

#![allow(unused)]
fn main() {
extern "C" { fn some_func<T>(x: T); }
}
<source>:3:13: error: foreign items may not have type parameters [E0044]
    3 | extern "C" { fn some_func<T>(x: T); }
      |             ^~

We've had similar issues with location tracking before, and it might be worthwhile to adjust our lexer a bit to reduce the prevalence of these kinds of bugs

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 with the reduced Rust example and its diagnostic output, then inspect gccrs lexer token-location tracking and compare the related discussion in issue #2376. Reproduce the reported column mismatch and determine the expected location for the foreign-item type-parameter error; done means the diagnostic points to the appropriate source span and regression coverage is added.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
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.