2023-02-22 01:41:48 +00:00
|
|
|
warning: lifetime parameter `'b` never used
|
|
|
|
--> $DIR/regions-static-bound.rs:3:17
|
|
|
|
|
|
|
|
|
LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t }
|
|
|
|
| -^^
|
|
|
|
| |
|
|
|
|
| help: elide the unused lifetime
|
|
|
|
|
|
|
|
|
note: the lint level is defined here
|
|
|
|
--> $DIR/regions-static-bound.rs:1:9
|
|
|
|
|
|
|
|
|
LL | #![warn(unused_lifetimes)]
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
2022-03-14 14:56:37 +00:00
|
|
|
warning: unnecessary lifetime parameter `'a`
|
2023-02-22 01:41:48 +00:00
|
|
|
--> $DIR/regions-static-bound.rs:3:53
|
2022-03-14 14:56:37 +00:00
|
|
|
|
|
2023-02-22 01:41:48 +00:00
|
|
|
LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t }
|
|
|
|
| ^^
|
2022-03-14 14:56:37 +00:00
|
|
|
|
|
|
|
|
= help: you can use the `'static` lifetime directly, in place of `'a`
|
|
|
|
|
|
|
|
warning: unnecessary lifetime parameter `'b`
|
2023-02-22 01:41:48 +00:00
|
|
|
--> $DIR/regions-static-bound.rs:8:19
|
2022-03-14 14:56:37 +00:00
|
|
|
|
|
|
|
|
LL | where 'a: 'b, 'b: 'static { t }
|
|
|
|
| ^^
|
|
|
|
|
|
|
|
|
= help: you can use the `'static` lifetime directly, in place of `'b`
|
|
|
|
|
2018-12-11 21:49:40 +00:00
|
|
|
error: lifetime may not live long enough
|
2023-02-22 01:41:48 +00:00
|
|
|
--> $DIR/regions-static-bound.rs:12:5
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
|
|
|
| -- lifetime `'a` defined here
|
2019-03-17 09:52:07 +00:00
|
|
|
LL | t
|
2018-08-14 20:26:33 +00:00
|
|
|
| ^ returning this value requires that `'a` must outlive `'static`
|
2018-11-28 21:05:36 +00:00
|
|
|
|
2021-11-13 05:43:43 +00:00
|
|
|
error[E0521]: borrowed data escapes outside of function
|
2023-02-22 01:41:48 +00:00
|
|
|
--> $DIR/regions-static-bound.rs:17:5
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-11-13 05:43:43 +00:00
|
|
|
LL | fn error(u: &(), v: &()) {
|
|
|
|
| - - let's call the lifetime of this reference `'1`
|
|
|
|
| |
|
|
|
|
| `u` is a reference that is only valid in the function body
|
2019-03-17 09:52:07 +00:00
|
|
|
LL | static_id(&u);
|
2021-11-13 05:43:43 +00:00
|
|
|
| ^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `u` escapes the function body here
|
|
|
|
| argument requires that `'1` must outlive `'static`
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2021-11-13 05:43:43 +00:00
|
|
|
error[E0521]: borrowed data escapes outside of function
|
2023-02-22 01:41:48 +00:00
|
|
|
--> $DIR/regions-static-bound.rs:19:5
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-11-13 05:43:43 +00:00
|
|
|
LL | fn error(u: &(), v: &()) {
|
|
|
|
| - - let's call the lifetime of this reference `'2`
|
|
|
|
| |
|
|
|
|
| `v` is a reference that is only valid in the function body
|
2022-04-19 10:56:18 +00:00
|
|
|
...
|
2019-03-17 09:52:07 +00:00
|
|
|
LL | static_id_indirect(&v);
|
2021-11-13 05:43:43 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `v` escapes the function body here
|
|
|
|
| argument requires that `'2` must outlive `'static`
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2023-02-22 01:41:48 +00:00
|
|
|
error: aborting due to 3 previous errors; 3 warnings emitted
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2021-11-13 05:43:43 +00:00
|
|
|
For more information about this error, try `rustc --explain E0521`.
|