]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/regions-proc-bound-capture.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / regions / regions-proc-bound-capture.rs
CommitLineData
dc9dc135 1fn borrowed_proc<'a>(x: &'a isize) -> Box<dyn FnMut()->(isize) + 'a> {
1a4d82fc
JJ
2 // This is legal, because the region bound on `proc`
3 // states that it captures `x`.
c34b1796 4 Box::new(move|| { *x })
1a4d82fc
JJ
5}
6
f035d41b 7fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> {
1a4d82fc 8 // This is illegal, because the region bound on `proc` is 'static.
04454e1e 9 Box::new(move || { *x })
923072b8 10 //~^ ERROR lifetime may not live long enough
1a4d82fc
JJ
11}
12
13fn main() { }