]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-proc-bound-capture.stderr
Auto merge of #74404 - lcnr:ty-dep-path-cleanup-aaaaa, r=eddyb
[rust.git] / src / test / ui / regions / regions-proc-bound-capture.stderr
1 error[E0759]: cannot infer an appropriate lifetime
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`.