rust/tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs
2023-01-11 09:32:08 +00:00

32 lines
448 B
Rust

#[derive(Default, PartialEq)]
struct Foo<T> {
bar: Box<[T]>,
}
trait Bar {
fn foo(&self) {}
}
impl<T: Default + Bar> Bar for Foo<T> {}
impl<T> Foo<T> {
fn bar(&self) {
self.foo();
//~^ ERROR the method
}
}
struct Fin<T> where T: Bar {
bar: Box<[T]>,
}
impl<T: Default + Bar> Bar for Fin<T> {}
impl<T: Bar> Fin<T> {
fn bar(&self) {
self.foo();
//~^ ERROR the method
}
}
fn main() {}