Skip to content

Syntax errors for new associated type where clause position #11651

Closed
@MingweiSamuel

Description

@MingweiSamuel

Associated type syntax has changed so the where clause comes after the assignment instead of before:

Minimized example code:

pub trait Trait {
    type AssociatedType where Self: Clone;
}

impl Trait for () {
    type AssociatedType = () where Self: Clone;
}

Result:

Syntax Error: expected SEMICOLON

Syntax Error: expected an item

Syntax Error: expected BANG
Syntax Error: expected `{`, `[`, `(`
Syntax Error: expected SEMICOLON
Syntax Error: expected an item

Syntax Error: expected BANG
Syntax Error: expected `{`, `[`, `(`

rust-analyzer version:

5fae65dd2 2022-03-07 stable
5fae65dd2 2022-03-07 nightly

rustc version: rustc 1.61.0-nightly (38a0b81b1 2022-03-06)

relevant settings: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserparser issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions