rust/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs
2024-02-27 17:43:40 +00:00

17 lines
303 B
Rust

trait Original {
fn f() -> impl Fn();
}
trait Erased {
fn f(&self) -> Box<dyn Fn()>;
}
impl<T: Original> Erased for T {
fn f(&self) -> Box<dyn Fn()> {
Box::new(<T as Original>::f())
//~^ ERROR the associated type `impl Fn()` may not live long enough
}
}
fn main () {}