83fa46fe5b
Add type annotations to MIR so that borrowck can pass constraints from inline constants in patterns to the containing function.
29 lines
1.0 KiB
Plaintext
29 lines
1.0 KiB
Plaintext
error[E0597]: `y` does not live long enough
|
|
--> $DIR/const-match-pat-lifetime-err.rs:29: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
|
|
--> $DIR/const-match-pat-lifetime-err.rs:39: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`.
|