rust-lang / rust-lang/rust-analyzer

Add support for trait aliases

Open
#2,773 2 comments 2 reactions 1 assignee View on GitHub

@lowr is already working on this.

Since Mar 1, 2023.

A-rustc A-ty B-unstable C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Trait aliases are currently a nightly feature.

Example code:

pub trait ValidGrouping<G> {
    type IsAggregate;
}

pub trait MixedAggregates {
    type Output;
}

mod is_aggregate {
    pub struct No;
}

pub trait NonAggregate = ValidGrouping<()>
where
    <Self as ValidGrouping<()>>::IsAggregate:
        MixedAggregates<is_aggregate::No, Output = is_aggregate::No>;

rust_analyzer seems not to be able to parse this correctly and returns a bunch of syntax errors:

383: rust-analyzer: Syntax Error: expected `{`
383: rust-analyzer: Syntax Error: expected an item
383: rust-analyzer: Syntax Error: expected EXCL
383: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
383: rust-analyzer: Syntax Error: expected SEMI
383: rust-analyzer: Syntax Error: expected an item
383: rust-analyzer: Syntax Error: expected an item
383: rust-analyzer: Syntax Error: expected an item
383: rust-analyzer: Syntax Error: expected an item
384: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected EXCL
385: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
385: rust-analyzer: Syntax Error: expected SEMI
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected EXCL
385: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
385: rust-analyzer: Syntax Error: expected SEMI
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected an item
385: rust-analyzer: Syntax Error: expected EXCL
385: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
385: rust-analyzer: Syntax Error: expected SEMI
385: rust-analyzer: Syntax Error: expected an item
386: rust-analyzer: Syntax Error: expected EXCL
386: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
386: rust-analyzer: Syntax Error: expected SEMI
386: rust-analyzer: Syntax Error: expected an item
386: rust-analyzer: Syntax Error: expected EXCL
386: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
386: rust-analyzer: Syntax Error: expected SEMI
386: rust-analyzer: Syntax Error: expected an item
386: rust-analyzer: Syntax Error: expected EXCL
386: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
386: rust-analyzer: Syntax Error: expected SEMI
386: rust-analyzer: Syntax Error: expected an item
386: rust-analyzer: Syntax Error: expected EXCL
386: rust-analyzer: Syntax Error: expected `{`, `[`, `(`
386: rust-analyzer: Syntax Error: expected SEMI
386: rust-analyzer: Syntax Error: expected an item
386: rust-analyzer: Syntax Error: expected an item

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.