]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/region-invariant-static-error-reporting.stderr
Rollup merge of #106043 - c410-f3r:moar-errors, r=petrochenkov
[rust.git] / src / test / ui / regions / region-invariant-static-error-reporting.stderr
1 error[E0521]: borrowed data escapes outside of function
2   --> $DIR/region-invariant-static-error-reporting.rs:14:9
3    |
4 LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
5    |          --  - `x` is a reference that is only valid in the function body
6    |          |
7    |          lifetime `'a` defined here
8 LL |     let bad = if x.is_some() {
9 LL |         x.unwrap()
10    |         ^^^^^^^^^^
11    |         |
12    |         `x` escapes the function body here
13    |         argument requires that `'a` must outlive `'static`
14    |
15    = note: requirement occurs because of the type `Invariant<'_>`, which makes the generic argument `'_` invariant
16    = note: the struct `Invariant<'a>` is invariant over the parameter `'a`
17    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
18
19 error: aborting due to previous error
20
21 For more information about this error, try `rustc --explain E0521`.