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