rust/tests/ui/regions/regions-infer-invariance-due-to-mutability-3.rs
2023-01-11 09:32:08 +00:00

16 lines
318 B
Rust

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() {
}