rust/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs

17 lines
303 B
Rust
Raw Normal View History

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())
2024-02-27 10:11:35 -06:00
//~^ ERROR the associated type `impl Fn()` may not live long enough
}
}
fn main () {}