fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
900 B25 linesraw
1error[E0308]: `if` and `else` have incompatible types
2  --> $DIR/region-invariant-static-error-reporting.rs:17:9
3   |
4LL |       let bad = if x.is_some() {
5   |  _______________-
6LL | |         x.unwrap()
7   | |         ---------- expected because of this
8LL | |     } else {
9LL | |         mk_static()
10   | |         ^^^^^^^^^^^ lifetime mismatch
11LL | |     };
12   | |_____- `if` and `else` have incompatible types
13   |
14   = note: expected struct `Invariant<'a>`
15              found struct `Invariant<'static>`
16note: the lifetime `'a` as defined on the function body at 13:10...
17  --> $DIR/region-invariant-static-error-reporting.rs:13:10
18   |
19LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
20   |          ^^
21   = note: ...does not necessarily outlive the static lifetime
22
23error: aborting due to previous error
24
25For more information about this error, try `rustc --explain E0308`.