fork/rust

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

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

master
1.1 KiB34 linesraw
1error[E0716]: temporary value dropped while borrowed
2  --> $DIR/regions-free-region-ordering-caller1.rs:9:27
3   |
4LL | fn call1<'a>(x: &'a usize) {
5   |          -- lifetime `'a` defined here
6...
7LL |     let z: &'a & usize = &(&y);
8   |            -----------    ^^^^ creates a temporary value which is freed while still in use
9   |            |
10   |            type annotation requires that borrow lasts for `'a`
11...
12LL | }
13   | - temporary value is freed at the end of this statement
14
15error[E0597]: `y` does not live long enough
16  --> $DIR/regions-free-region-ordering-caller1.rs:9:27
17   |
18LL | fn call1<'a>(x: &'a usize) {
19   |          -- lifetime `'a` defined here
20...
21LL |     let y: usize = 3;
22   |         - binding `y` declared here
23LL |     let z: &'a & usize = &(&y);
24   |            -----------    ^^^^ borrowed value does not live long enough
25   |            |
26   |            type annotation requires that `y` is borrowed for `'a`
27...
28LL | }
29   | - `y` dropped here while still borrowed
30
31error: aborting due to 2 previous errors
32
33Some errors have detailed explanations: E0597, E0716.
34For more information about an error, try `rustc --explain E0597`.