Closed
Description
Type aliases using associated types / as
to resolve to a concrete type do not work as expected:
trait Tr {
type Ty;
fn f(self) -> Self::Ty;
}
impl Tr for () {
type Ty = f32;
fn f(self) -> Self::Ty { 0.5 }
}
type TrTy<T> = <T as Tr>::Ty;
fn main() {
let _: <() as Tr>::Ty = Tr::f(()); // works
let _: TrTy<()> = Tr::f(()); // error
}
error: mismatched types [--explain E0308]
--> <anon>:16:23
16 |> let _: TrTy<()> = Tr::f(()); // error
|> ^^^^^^^^^ expected associated type, found f32
note: expected type `<() as Tr>::Ty`
note: found type `f32`
Metadata
Metadata
Assignees
Labels
No labels