2015-01-06 16:33:42 -06:00
|
|
|
use std::marker;
|
2014-01-22 13:03:02 -06:00
|
|
|
|
2018-12-16 21:21:47 -06:00
|
|
|
struct Invariant<'a> {
|
2015-02-12 09:29:52 -06:00
|
|
|
marker: marker::PhantomData<*mut &'a()>
|
2014-01-22 13:03:02 -06:00
|
|
|
}
|
|
|
|
|
2018-12-16 21:21:47 -06:00
|
|
|
fn to_same_lifetime<'r>(b_isize: Invariant<'r>) {
|
|
|
|
let bj: Invariant<'r> = b_isize;
|
2014-01-22 13:03:02 -06: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
|
2014-01-22 13:03:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|