1 // This test checks that the error messages you get for this example
2 // at least mention `'a` and `'static`. The precise messages can drift
3 // over time, but this test used to exhibit some pretty bogus messages
4 // that were not remotely helpful.
7 // ignore-compare-mode-nll
8 //[base] error-pattern:the lifetime `'a`
9 //[base] error-pattern:the static lifetime
10 //[nll] compile-flags: -Z borrowck=mir
11 //[nll] error-pattern:argument requires that `'a` must outlive `'static`
13 struct Invariant<'a>(Option<&'a mut &'a mut ()>);
15 fn mk_static() -> Invariant<'static> { Invariant(None) }
17 fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
18 let bad = if x.is_some() {
19 x.unwrap() //[nll]~ ERROR borrowed data escapes outside of function [E0521]
21 mk_static() //[base]~ ERROR `if` and `else` have incompatible types [E0308]