2018-08-08 07:28:26 -05:00
|
|
|
error[E0597]: `a` does not live long enough
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/regions-addr-of-arg.rs:5:30
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2023-01-14 21:06:44 -06:00
|
|
|
LL | fn foo(a: isize) {
|
|
|
|
| - binding `a` declared here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _p: &'static isize = &a;
|
2019-04-22 02:40:08 -05:00
|
|
|
| -------------- ^^ borrowed value does not live long enough
|
|
|
|
| |
|
|
|
|
| type annotation requires that `a` is borrowed for `'static`
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | }
|
2019-04-22 02:40:08 -05:00
|
|
|
| - `a` dropped here while still borrowed
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0515]: cannot return reference to function parameter `a`
|
|
|
|
--> $DIR/regions-addr-of-arg.rs:13:5
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | &a
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^ returns a reference to data owned by the current function
|
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: E0515, E0597.
|
|
|
|
For more information about an error, try `rustc --explain E0515`.
|