]> git.proxmox.com Git - rustc.git/blob - src/test/ui/regions/regions-proc-bound-capture.stderr
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / regions / regions-proc-bound-capture.stderr
1 error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2 --> $DIR/regions-proc-bound-capture.rs:9:14
3 |
4 LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> {
5 | ------ this data with an anonymous lifetime `'_`...
6 LL | // This is illegal, because the region bound on `proc` is 'static.
7 LL | Box::new(move || { *x })
8 | ^^^^^^^^^^^^^^ ...is captured here, requiring it to live as long as `'static`
9 |
10 help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x`
11 |
12 LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + '_> {
13 | ~~
14 help: alternatively, add an explicit `'static` bound to this reference
15 |
16 LL | fn static_proc(x: &'static isize) -> Box<dyn FnMut() -> (isize) + 'static> {
17 | ~~~~~~~~~~~~~~
18
19 error: aborting due to previous error
20
21 For more information about this error, try `rustc --explain E0759`.