2015-01-06 22:33:42 +00:00
|
|
|
use std::marker;
|
2014-01-22 19:03:02 +00:00
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
struct Invariant<'a> {
|
2015-02-12 15:29:52 +00:00
|
|
|
marker: marker::PhantomData<*mut &'a()>
|
2014-01-22 19:03:02 +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;
|
2014-01-22 19:03:02 +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
|
2014-01-22 19:03:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|