-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-hirhir and hir-def relatedhir and hir-def relatedA-nameresname, path and module resolutionname, path and module resolutionA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
I'm not sure the best title for this issue, so feel free to rename:
Consider the following code:
trait Foo {
type Bar;
fn baz() -> Self::Bar;
}
enum BarEnum {
Qux { x: u32 },
Tup(),
Reg,
}
impl BarEnum {
fn method() -> Self {
Self::Tup()
}
}
impl Foo for String {
type Bar = BarEnum;
fn baz() -> Self::Bar {
Self::Bar::Qux { x: 1 };
// ^^^ ^^^ ^
// unresolved
Self::Bar::Tup();
// ^^^
// unresolved
Self::Bar::Reg;
// ^^^
// unresolved
Self::Bar::method()
// ^^^
// unresolved
}
}
When referring to BarEnum
as Self::Bar
, rust-analyzer seems to be unable to resolve. Here is a screenshot with a red semantic token.
This breaks autocomplete, and also stuff like rename symbol, for example renaming BarEnum::Qux
, does not cause Self::Bar::Qux
to be renamed. Additionally renaming type Bar
also does not rename where its unresilved.
Self::Bar
only becomes unresolved after you type ::
after it:
rust-analyzer version: rust-analyzer version: 0.4.1445-standalone
rustc version: rustc 1.66.1 (90743e729 2023-01-10)
Metadata
Metadata
Assignees
Labels
A-hirhir and hir-def relatedhir and hir-def relatedA-nameresname, path and module resolutionname, path and module resolutionA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug