rust/tests/ui/impl-trait/associated-type-cycle.rs

15 lines
290 B
Rust

trait Foo {
type Bar;
fn foo(self) -> Self::Bar;
}
impl Foo for Box<dyn Foo> {
//~^ ERROR: the value of the associated type `Bar` in `Foo` must be specified
type Bar = <Self as Foo>::Bar;
fn foo(self) -> <Self as Foo>::Bar {
(*self).foo()
}
}
fn main() {}