fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
886 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 type `Invariant<'a>`
15              found type `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`.