rust/tests/ui/lifetimes/no_lending_iterators.stderr
2024-06-21 19:00:18 -04:00

31 lines
1.3 KiB
Plaintext

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`.