error[E0308]: if and else have incompatible types --> $DIR/region-invariant-static-error-reporting.rs:17: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 type `Invariant<'a>` found type `Invariant<'static>` note: the lifetime 'a as defined on the function body at 13:10... --> $DIR/region-invariant-static-error-reporting.rs:13: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`.