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