fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.1 KiB32 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 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 z: &'a & usize = &(&y);
22   |            -----------    ^^^^ borrowed value does not live long enough
23   |            |
24   |            type annotation requires that `y` is borrowed for `'a`
25...
26LL | }
27   | - `y` dropped here while still borrowed
28
29error: aborting due to 2 previous errors
30
31Some errors have detailed explanations: E0597, E0716.
32For more information about an error, try `rustc --explain E0597`.