2024-01-26 07:23:55 -06:00
|
|
|
error[E0597]: `y` does not live long enough
|
2024-08-17 07:19:34 -05:00
|
|
|
--> $DIR/const-match-pat-lifetime-err.rs:27:29
|
2024-01-26 07:23:55 -06:00
|
|
|
|
|
|
|
|
LL | fn match_invariant_ref<'a>() {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
LL | let y = ();
|
|
|
|
| - binding `y` declared here
|
|
|
|
LL | match InvariantRef::new(&y) {
|
|
|
|
| ^^ borrowed value does not live long enough
|
|
|
|
LL |
|
|
|
|
LL | const { InvariantRef::<'a>::NEW } => (),
|
|
|
|
| --------------------------------- type annotation requires that `y` is borrowed for `'a`
|
|
|
|
LL | }
|
|
|
|
LL | }
|
|
|
|
| - `y` dropped here while still borrowed
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2024-08-17 07:19:34 -05:00
|
|
|
--> $DIR/const-match-pat-lifetime-err.rs:37:12
|
2024-01-26 07:23:55 -06:00
|
|
|
|
|
|
|
|
LL | fn match_covariant_ref<'a>() {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
...
|
|
|
|
LL | let y: (CovariantRef<'static, _>,) = (CovariantRef(&()),);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|