2019-04-22 02:40:08 -05:00
|
|
|
error[E0716]: temporary value dropped while borrowed
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/regions-free-region-ordering-caller1.rs:9:27
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | fn call1<'a>(x: &'a usize) {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
...
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | let z: &'a & usize = &(&y);
|
2022-10-20 10:43:27 -05:00
|
|
|
| ----------- ^^^^ creates a temporary value which is freed while still in use
|
2019-04-22 02:40:08 -05:00
|
|
|
| |
|
|
|
|
| type annotation requires that borrow lasts for `'a`
|
2018-08-08 07:28:26 -05:00
|
|
|
...
|
|
|
|
LL | }
|
2019-04-22 02:40:08 -05:00
|
|
|
| - temporary value is freed at the end of this statement
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0597]: `y` does not live long enough
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/regions-free-region-ordering-caller1.rs:9:27
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | fn call1<'a>(x: &'a usize) {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
...
|
2023-01-14 21:06:44 -06:00
|
|
|
LL | let y: usize = 3;
|
|
|
|
| - binding `y` declared here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | let z: &'a & usize = &(&y);
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----------- ^^^^ borrowed value does not live long enough
|
|
|
|
| |
|
|
|
|
| type annotation requires that `y` is borrowed for `'a`
|
2018-08-08 07:28:26 -05:00
|
|
|
...
|
|
|
|
LL | }
|
2019-04-22 02:40:08 -05:00
|
|
|
| - `y` dropped here while still borrowed
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
Some errors have detailed explanations: E0597, E0716.
|
|
|
|
For more information about an error, try `rustc --explain E0597`.
|