summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
blob: da76ac1c474a3ee5ba3c43e86bba39c4ef78ff01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
  --> $DIR/projection-no-regions-fn.rs:13:5
   |
LL | fn no_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
   |              -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
...
LL |     Box::new(x.next())
   |     ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
   |
help: consider adding an explicit lifetime bound
   |
LL |     T: Iterator, <T as Iterator>::Item: 'a
   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
  --> $DIR/projection-no-regions-fn.rs:28:5
   |
LL | fn wrong_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>
   |                 -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
...
LL |     Box::new(x.next())
   |     ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
   |
help: consider adding an explicit lifetime bound
   |
LL |     T: 'b + Iterator, <T as Iterator>::Item: 'a
   |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0309`.