error[E0308]: `if` and `else` have incompatible types --> $DIR/region-invariant-static-error-reporting.rs:21:9 | LL | let bad = if x.is_some() { | _______________- LL | | x.unwrap() | | ---------- expected because of this LL | | } else { LL | | mk_static() | | ^^^^^^^^^^^ lifetime mismatch LL | | }; | |_____- `if` and `else` have incompatible types | = note: expected struct `Invariant<'a>` found struct `Invariant<'static>` note: the lifetime `'a` as defined here... --> $DIR/region-invariant-static-error-reporting.rs:17:10 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { | ^^ = note: ...does not necessarily outlive the static lifetime error: aborting due to previous error For more information about this error, try `rustc --explain E0308`.