mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 00:24:03 +00:00
c270a42fea
Move verbose logic to a function Minor renaming
21 lines
1.0 KiB
Plaintext
21 lines
1.0 KiB
Plaintext
error[E0700]: hidden type for `impl Iterator<Item = i32>` captures lifetime that does not appear in bounds
|
|
--> $DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:7:5
|
|
|
|
|
LL | fn bar(src: &crate::Foo) -> impl Iterator<Item = i32> {
|
|
| ---------- ------------------------- opaque type defined here
|
|
| |
|
|
| hidden type `FilterMap<std::slice::Iter<'static, i32>, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:9:21: 9:24}>` captures the anonymous lifetime defined here
|
|
LL | / [0].into_iter()
|
|
LL | |
|
|
LL | | .filter_map(|_| foo(src))
|
|
| |_________________________________^
|
|
|
|
|
help: to declare that `impl Iterator<Item = i32>` captures `'_`, you can introduce a named lifetime parameter `'a`
|
|
|
|
|
LL | fn bar<'a>(src: &'a crate::Foo<'a>) -> impl Iterator<Item = i32> + 'a {
|
|
| ++++ ++ ++++ ++++
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0700`.
|