Skip to content

Associated type incorrectly annotated with generic syntax #6191

@cole-miller

Description

@cole-miller

First of all, thanks for a very useful tool!

When I edit the following code:

pub trait Foo {
    type Bar: Default;
}

pub fn quux<T: Foo>() -> T::Bar {
    let y = Default::default();

    y
}

rust-analyzer annotates y with the nonsensical type Foo::Bar<T>, instead of the correct <T as Foo>::Bar. Clicking to insert this annotation results in a compilation error as expected (E0223).

I'm using Visual Studio Code 1.47.2 with version 0.2.336 of the rust-analyzer plugin (installed from the marketplace) and the latest stable rustc. I have not installed the official Rust plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionE-easyE-has-instructionsIssue has some instructions and pointers to code to get startedS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions