]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/bugs/hrtb-implied-2.stderr
Rollup merge of #106664 - chenyukang:yukang/fix-106597-remove-lseek, r=cuviper
[rust.git] / tests / ui / generic-associated-types / bugs / hrtb-implied-2.stderr
1 error[E0521]: borrowed data escapes outside of function
2   --> $DIR/hrtb-implied-2.rs:18:17
3    |
4 LL | fn fails<I: LendingIterator, F>(iter: &mut I, f: F) -> bool
5    |                                 ----  - let's call the lifetime of this reference `'1`
6    |                                 |
7    |                                 `iter` is a reference that is only valid in the function body
8 ...
9 LL |     let _next = iter2.next();
10    |                 ^^^^^^^^^^^^
11    |                 |
12    |                 `iter` escapes the function body here
13    |                 argument requires that `'1` must outlive `'static`
14    |
15    = note: requirement occurs because of a mutable reference to `Eat<&mut I, F>`
16    = note: mutable references are invariant over their type parameter
17    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
18    = note: due to current limitations in the borrow checker, this implies a `'static` lifetime
19
20 error: aborting due to previous error
21
22 For more information about this error, try `rustc --explain E0521`.