fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.0 KiB29 linesraw
1error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
2  --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
3   |
4LL |   y.push(z);
5   |   ^ cannot borrow as mutable
6   |
7help: consider changing this to be mutable
8   |
9LL | fn foo(x:fn(&u8, &u8), mut y: Vec<&u8>, z: &u8) {
10   |                        +++
11
12error: lifetime may not live long enough
13  --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
14   |
15LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
16   |                               -        - let's call the lifetime of this reference `'1`
17   |                               |
18   |                               let's call the lifetime of this reference `'2`
19LL |   y.push(z);
20   |   ^^^^^^^^^ argument requires that `'1` must outlive `'2`
21   |
22help: consider introducing a named lifetime parameter
23   |
24LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) {
25   |       ++++                         ++          ++
26
27error: aborting due to 2 previous errors
28
29For more information about this error, try `rustc --explain E0596`.