Open
Description
rust-analyzer version: 0.4.2336-standalone (5e7dd31 2025-03-09)
rustc version: rustc 1.87.0-nightly (f4a216d28 2025-03-02)
editor or extension: VSCode 0.4.2336
repository link (if public, optional): https://github.com/paradigmxyz/reth
code snippet to reproduce:
trait Bar {
type Baz;
fn baz(&self) -> Self::Baz;
}
trait Foo {
type Bar;
fn bar(&self) -> Self::Bar;
}
trait FooFactory {
type Output: Foo<Bar: Bar<Baz = u8>>;
fn foo(&self) -> Self::Output;
fn foo_rpit(&self) -> impl Foo<Bar: Bar<Baz = u8>>;
}
fn test1(foo: impl Foo<Bar: Bar<Baz = u8>>) {
// baz: u8 inferred
let baz = foo.bar().baz();
}
fn test2<T: FooFactory>(factory: T) {
// type unknown
let baz = factory.foo().bar().baz();
let baz = factory.foo_rpit().bar().baz();
}
It seems that in some cases rust-analyzer is failing to resolve more complex bounds while simpler bounds involving the same types are getting resolved correctlty