rust/tests/ui/regions/regions-free-region-ordering-caller1.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.1 KiB
Plaintext
Raw Normal View History

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
|
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);
| ----------- ^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'a`
2018-08-08 07:28:26 -05:00
...
LL | }
| - 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
--> $DIR/regions-free-region-ordering-caller1.rs:9:27
2018-08-08 07:28:26 -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);
| ----------- ^^^^ 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 | }
| - `y` dropped here while still borrowed
2018-08-08 07:28:26 -05:00
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0597, E0716.
For more information about an error, try `rustc --explain E0597`.