rust/tests/ui/regions/regions-infer-invariance-due-to-decl.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
330 B
Rust
Raw Normal View History

2015-01-06 22:33:42 +00:00
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
2022-04-01 17:13:25 +00:00
//~^ ERROR lifetime may not live long enough
}
fn main() {
}