Open
Description
The try_collect method in itertools is shadowing the method of the same name in std::iter on nightly :
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.try_collect
#![allow(unused)]
#![feature(iterator_try_collect)]
use itertools::Itertools; // 0.10.5
fn main() {
let u = vec![Some(1), Some(2), Some(3)];
let v = u.into_iter().try_collect::<Vec<i32>>();
assert_eq!(v, Some(vec![1, 2, 3]));
}
Compiling playground v0.0.1 (/playground)
error[[E0107]](https://doc.rust-lang.org/nightly/error-index.html#E0107): this associated function takes 3 generic arguments but 1 generic argument was supplied
--> src/main.rs:8:27
|
8 | let v = u.into_iter().try_collect::<Vec<i32>>();
| ^^^^^^^^^^^ -------- supplied 1 generic argument
| |
| expected 3 generic arguments
|
note: associated function defined here, with 3 generic parameters: `T`, `U`, `E`
--> /playground/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.10.5/src/lib.rs:2009:8
|
2009 | fn try_collect<T, U, E>(self) -> Result<U, E>
| ^^^^^^^^^^^ - - -
help: add missing generic arguments
|
8 | let v = u.into_iter().try_collect::<Vec<i32>, U, E>();
| ++++++
error[[E0271]](https://doc.rust-lang.org/nightly/error-index.html#E0271): expected `IntoIter<Option<{integer}>>` to be an iterator that yields `Result<Vec<i32>, _>`, but it yields `Option<{integer}>`
--> src/main.rs:8:27
|
8 | let v = u.into_iter().try_collect::<Vec<i32>>();
| ^^^^^^^^^^^ expected enum `Result`, found enum `Option`
|
= note: expected enum `Result<Vec<i32>, _>`
found enum `Option<{integer}>`
note: the method call chain might not have had the expected associated types
--> src/main.rs:8:15
|
7 | let u = vec![Some(1), Some(2), Some(3)];
| ------------------------------- this expression has type `Vec<Option<{integer}>>`
8 | let v = u.into_iter().try_collect::<Vec<i32>>();
| ^^^^^^^^^^^ `Iterator::Item` is `Option<{integer}>` here
note: required by a bound in `itertools::Itertools::try_collect`
--> /playground/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.10.5/src/lib.rs:2011:32
|
2011 | Self: Sized + Iterator<Item = Result<T, E>>,
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Itertools::try_collect`
error[[E0308]](https://doc.rust-lang.org/nightly/error-index.html#E0308): mismatched types
--> src/main.rs:9:5
|
9 | assert_eq!(v, Some(vec![1, 2, 3]));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found enum `Option`
|
= note: expected enum `Result<_, _>`
found enum `Option<Vec<{integer}>>`
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0107, E0271, E0308.
For more information about an error, try `rustc --explain E0107`.
error: could not compile `playground` due to 3 previous errors