rust/tests/ui/inline-const/const-match-pat-lifetime-err.stderr

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

29 lines
1.0 KiB
Plaintext
Raw Normal View History

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
|
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
|
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`.