mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-05 06:27:38 +00:00
17 lines
321 B
Rust
17 lines
321 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 `<T as Original>::{opaque#0}` may not live long enough
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main () {}
|