]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/regions/region-invariant-static-error-reporting.rs
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.
6 // error-pattern:argument requires that `'a` must outlive `'static`
8 struct Invariant
<'a
>(Option
<&'a
mut &'a
mut ()>);
10 fn mk_static() -> Invariant
<'
static> { Invariant(None) }
12 fn unify
<'a
>(x
: Option
<Invariant
<'a
>>, f
: fn(Invariant
<'a
>)) {
13 let bad
= if x
.is_some() {
14 x
.unwrap() //~ ERROR borrowed data escapes outside of function [E0521]