]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / impl-trait / static-return-lifetime-infered.nll.stderr
1 error: unsatisfied lifetime constraints
2   --> $DIR/static-return-lifetime-infered.rs:17:9
3    |
4 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
5    |                         - let's call the lifetime of this reference `'1`
6 LL |         self.x.iter().map(|a| a.0)
7    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
8 help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
9    |
10 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
11    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
13 error: unsatisfied lifetime constraints
14   --> $DIR/static-return-lifetime-infered.rs:21:9
15    |
16 LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
17    |                    -- lifetime `'a` defined here
18 LL |         self.x.iter().map(|a| a.0)
19    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
20 help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
21    |
22 LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
23    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24
25 error: aborting due to 2 previous errors
26