Skip to content

no code completion on &impl T return type #21749

@scalpel4k

Description

@scalpel4k
trait A { fn hello(&self); } trait B { fn test_1(&self) -> &impl A; fn test_2(&self) -> &dyn A; } struct C { } impl A for C { fn hello(&self) { } } impl B for C { fn test_1(&self) -> &impl A { self } fn test_2(&self) -> &dyn A { self } } fn test() { let c = C{}; c.test_1().<1>; // no hello() completion c.test_2().<2>; // hello() part of code suggestions c.test_1().hello(); // properly resolved  c.test_2().hello(); // properly resolved }

For <1> in you the code you don't get any useful code completion. But when changing from &impl T to &dyn T code-completion starts to work.

Currently rust-analyzer 0.4.2813 is installed.

Metadata

Metadata

Labels

A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions