2016-11-10 11:08:21 -06:00
|
|
|
#![feature(fn_traits)]
|
|
|
|
|
2013-01-19 19:39:15 -06:00
|
|
|
fn id<T>(t: T) -> T { t }
|
|
|
|
|
2019-05-28 13:46:13 -05:00
|
|
|
fn f<'r, T>(v: &'r T) -> Box<dyn FnMut() -> T + 'r> {
|
2015-02-15 02:52:21 -06:00
|
|
|
id(Box::new(|| *v))
|
2019-11-08 16:54:00 -06:00
|
|
|
//~^ ERROR E0507
|
2013-11-19 19:36:32 -06:00
|
|
|
}
|
2013-01-19 19:39:15 -06:00
|
|
|
|
|
|
|
fn main() {
|
2015-01-31 10:23:42 -06:00
|
|
|
let v = &5;
|
2015-01-03 09:45:00 -06:00
|
|
|
println!("{}", f(v).call_mut(()));
|
2013-02-14 13:47:00 -06:00
|
|
|
}
|