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

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

16 lines
318 B
Rust
Raw Normal View History

struct Invariant<'a> {
2019-05-28 18:46:13 +00:00
f: Box<dyn FnOnce(&mut &'a isize) + 'static>,
}
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() {
}