Associated-type where clause is only parsed in the deprecated position, blocking deprecated_where_clause_location lint

Open
#4,656 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp, rust
Domain
compilers

Research direction

Start by reproducing the two associated-type declarations from the issue and trace the gccrs parser path for type Assoc = ... where ...;. Done means the modern where-clause position parses successfully while the deprecated position remains accepted for the deprecated_where_clause_location lint to diagnose.

Written by the indexing model from the issue text.

Description

The rustc deprecated_where_clause_location lint warns when an associated type's where clause is written before the = (the deprecated position) and suggests moving it after.

gccrs currently parses only the deprecated position and hard-errors on the modern one:

impl Trait for S {
    type Assoc where Self: Sized = Self;   // accepted by gccrs
    // type Assoc = Self where Self: Sized; // gccrs: "expecting `;` but `where` found"
}

Because the corrected form is a parse error, the lint would fire on the only syntax gccrs accepts and have no valid alternative to suggest, so it is not implementable today. Supporting the modern type Assoc = ... where ...; position would both fix a parser gap and unblock the lint.

Dominant language
C++
Stars
3k
Forks
238
Avg merge
4d 8h
Merged PRs (30d)
31

Getting set up

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.

More from Rust-GCC/gccrs

All issues in Rust-GCC/gccrs

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.