File: no_lending_iterators.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (30 lines) | stat: -rw-r--r-- 1,322 bytes parent folder | download | duplicates (3)
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
error: associated type `Iterator::Item` is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type
  --> $DIR/no_lending_iterators.rs:4:17
   |
LL |     type Item = &str;
   |                 ^
   |
note: you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type
  --> $DIR/no_lending_iterators.rs:3:19
   |
LL | impl Iterator for Data {
   |                   ^^^^

error: in the trait associated type is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type
  --> $DIR/no_lending_iterators.rs:18:17
   |
LL |     type Item = &usize;
   |                 ^ this lifetime must come from the implemented type

error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration
  --> $DIR/no_lending_iterators.rs:27:14
   |
LL |     type Item;
   |              - lifetimes in impl do not match this type in trait
...
LL |     type Item<'a> = &'a isize;
   |              ^^^^ lifetimes do not match type in trait

error: aborting due to 3 previous errors

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