]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
Rollup merge of #95916 - solid-rs:feat-kmc-solid-abort, r=Mark-Simulacrum
[rust.git] / src / test / ui / lifetimes / lifetime-errors / ex3-both-anon-regions-using-trait-objects.stderr
1 error: lifetime may not live long enough
2   --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
3    |
4 LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
5    |                                         -        - let's call the lifetime of this reference `'1`
6    |                                         |
7    |                                         let's call the lifetime of this reference `'2`
8 LL |   y.push(z);
9    |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
10    |
11 help: consider introducing a named lifetime parameter
12    |
13 LL | fn foo<'a>(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&'a u8>, z: &'a u8) {
14    |       ++++                                   ++          ++
15
16 error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
17   --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
18    |
19 LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
20    |                                  - help: consider changing this to be mutable: `mut y`
21 LL |   y.push(z);
22    |   ^^^^^^^^^ cannot borrow as mutable
23
24 error: aborting due to 2 previous errors
25
26 For more information about this error, try `rustc --explain E0596`.