Closed
Description
Consider the following:
trait Foo { type FooT; }
trait Bar { }
trait FooBar: Foo<FooT=usize> + Bar { }
type BoxedFooBar = Box<FooBar>;
Since the value of FooT
is known from the definition of FooBar
, line 4 should be fine — if FB: FooBar
then necessarily FB::FooT = usize
. However, this fails to compile with rustc 1.12.0, with the error:
error[E0191]: the value of the associated type `FooT` (from the trait `Foo`) must be specified
--> <anon>:4:24
|
4 | type BoxedFooBar = Box<FooBar>;
| ^^^^^^ missing associated type `FooT` value
To make it compile, one must duplicate the information at every use-site:
trait Foo { type FooT; }
trait Bar { }
trait FooBar: Foo<FooT=usize> + Bar { }
type BoxedFooBar = Box<FooBar<FooT=usize>>;