Skip to content

associated type is unresolved when trait path is qualified. #11973

Closed
@jhgg

Description

@jhgg
fn main() {}

trait T1 {
    type Bar;
    type Baz;
}

struct Foo;

mod t2 {
    pub trait T2 {
        type Bar;
    }
}

use t2::T2;

impl T2 for Foo {
    type Bar = String;
}

impl T1 for Foo {
    type Bar = <Foo as t2::T2>::Bar;
    //                          ^^^ unresolvedReference
    type Baz = <Foo as T2>::Bar;
    //                      ^^^ typeAlias
}

When T2 is used as t2::T2, Bar is unresolved, but when using T2 directly by getting it in scope w/ use t2::T2;, it is resolved properly.

rust-analyzer version: 14c86d5 2022-04-13 dev
rustc 1.60.0 (7737e0b5c 2022-04-04)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-nameresname, path and module resolutionC-bugCategory: bugS-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