2012-04-05 16:10:14 +00:00
|
|
|
fn ignore<T>(t: T) {}
|
|
|
|
|
2015-01-08 10:54:35 +00:00
|
|
|
fn nested<'x>(x: &'x isize) {
|
2012-04-05 16:10:14 +00:00
|
|
|
let y = 3;
|
2022-04-19 10:56:18 +00:00
|
|
|
let mut ay = &y;
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR `y` does not live long enough [E0597]
|
2012-04-05 16:10:14 +00:00
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| {
|
2016-03-17 08:15:06 +00:00
|
|
|
ay = x;
|
2013-03-15 19:24:24 +00:00
|
|
|
ay = &y;
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR `y` does not live long enough
|
2012-08-13 22:06:13 +00:00
|
|
|
ay = z;
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR borrowed data escapes outside of closure [E0521]
|
2015-02-15 08:52:21 +00:00
|
|
|
}));
|
2012-04-05 16:10:14 +00:00
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
2022-04-19 10:56:18 +00:00
|
|
|
if false { return x; }
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
2012-08-13 22:06:13 +00:00
|
|
|
if false { return ay; }
|
2012-08-02 00:30:05 +00:00
|
|
|
return z;
|
2015-02-15 08:52:21 +00:00
|
|
|
}));
|
2012-04-05 16:10:14 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
fn main() {}
|