Closed
Description
I tried this code:
trait Array {
type Item;
}
trait Platform {
type Assoc: Array<Item = Self::Assoc2>;
type Assoc2;
}
struct Message<A, B>
where
A: Array<Item = B>,
{
pub field: A,
}
impl<A, B> Clone for Message<A, B>
where
A: Array<Item = B>,
{
fn clone(&self) -> Self {
todo!()
}
}
fn clone<P: Platform>(x: &Message<P::Assoc, P::Assoc2>) {
let x: Message<_, _> = Clone::clone(x);
}
I expected it to work.
Instead, this happened:
error[E0282]: type annotations needed
--> src/lib.rs:31:32
|
31 | Enum::Variant(Clone::clone(x))
| ^ cannot infer type for reference `&Message<<P as Platform>::Assoc, _>`
I regressed this in #129059. I have no idea yet why it's happening! This also could be minimized further, I think.