blob: 102abc0e0d8b61e877af76b73bb53eeba636880b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use std::marker;
struct Invariant<'a> {
marker: marker::PhantomData<*mut &'a()>
}
fn to_same_lifetime<'r>(b_isize: Invariant<'r>) {
let bj: Invariant<'r> = b_isize;
}
fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
b_isize
//~^ ERROR lifetime may not live long enough
}
fn main() {
}
|