]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / regions / regions-infer-invariance-due-to-mutability-4.rs
CommitLineData
04454e1e
FG
1// revisions: base nll
2// ignore-compare-mode-nll
3//[nll] compile-flags: -Z borrowck=mir
4
85aaf69f 5struct Invariant<'a> {
dc9dc135 6 f: Box<dyn FnOnce() -> *mut &'a isize + 'static>,
223e47cc
LB
7}
8
85aaf69f
SL
9fn to_same_lifetime<'r>(b_isize: Invariant<'r>) {
10 let bj: Invariant<'r> = b_isize;
223e47cc
LB
11}
12
85aaf69f 13fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
04454e1e
FG
14 b_isize
15 //[base]~^ ERROR mismatched types
16 //[nll]~^^ ERROR lifetime may not live long enough
223e47cc
LB
17}
18
19fn main() {
20}