Skip to content

Add support for trait aliases #2773

Open
@weiznich

Description

@weiznich

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

Metadata

Metadata

Assignees

Labels

A-rustcissues regarding the rustc codebase and rustc private cratesA-tytype system / type inference / traits / method resolutionB-unstableunstable featureC-featureCategory: feature request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions