mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
17 lines
303 B
Rust
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 () {}
|