summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
blob: 1078f77a04ebfe63a4d49a7d553872074ccf62a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct Invariant<'a> {
    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
    //~^ ERROR lifetime may not live long enough
}

fn main() {
}