2018-12-17 03:21:47 +00:00
|
|
|
struct Invariant<'a> {
|
2019-05-28 18:46:13 +00:00
|
|
|
f: Box<dyn FnOnce(&mut &'a isize) + 'static>,
|
2012-08-09 16:59:50 +00:00
|
|
|
}
|
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
fn to_same_lifetime<'r>(b_isize: Invariant<'r>) {
|
|
|
|
let bj: Invariant<'r> = b_isize;
|
2012-08-09 16:59:50 +00:00
|
|
|
}
|
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
|
2022-04-19 10:56:18 +00:00
|
|
|
b_isize
|
2022-04-01 17:13:25 +00:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
2012-08-09 16:59:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2013-02-14 19:47:00 +00:00
|
|
|
}
|