Closed
Description
Test case:
#![feature(associated_types)]
trait Int {
fn one() -> Self;
fn leading_zeros(self) -> uint;
}
trait Foo {
type T : Int;
fn test(&self) -> uint {
let r: <Self as Foo>::T = Int::one();
r.leading_zeros()
}
}
fn main() {
}
Currently fails with:
1.rs:12:25: 12:28 error: unsupported associated type binding
1.rs:12 let r: <Self as Foo>::T = Int::one();
^~~
error: aborting due to previous error
This can be worked around by making that Int::one()
expression into a method of the trait returning <Self as Foo>::T
, but then that method would become public as well, which may not be desirable.