rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

type inference breaks if there is more than one IntoIterator bound.

Open jhgg opened this issue 3 years ago • 2 comments

With this code, the B: IntoIterator<Item = Foo>, bound added breaks inference on a.

struct Foo {
    bar: u64,
}

fn what<A, B>(a: A, b: B)
where
    A: IntoIterator<Item = Foo>,
    B: IntoIterator<Item = Foo>,
{
    a.into_iter().map(|x| x.bar).count();
}

image image

rust-analyzer version: dd43f3f2d 2021-10-27 nightly

jhgg avatar Oct 28 '21 00:10 jhgg

Likely the same issue as #9990

flodiebold avatar Oct 28 '21 07:10 flodiebold

https://github.com/rust-lang/chalk/issues/750 is the Chalk root cause. #11242 has a reproduction in a hir-ty test.

flodiebold avatar Feb 15 '24 19:02 flodiebold