rust/src/test/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.

21 lines
452 B
Rust
Raw Normal View History

// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
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
//[base]~^ ERROR mismatched types
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() {
}