diff --git a/library/core/src/iter/traits/collect.rs b/library/core/src/iter/traits/collect.rs index d89801bce2b..788edfc3f8f 100644 --- a/library/core/src/iter/traits/collect.rs +++ b/library/core/src/iter/traits/collect.rs @@ -150,6 +150,20 @@ pub trait FromIterator: Sized { fn from_iter>(iter: T) -> Self; } +#[stable(feature = "from_iterator_for_tuple", since = "CURRENT_RUSTC_VERSION")] +impl FromIterator<(AE, BE)> for (A, B) +where + A: Default + Extend, + B: Default + Extend, +{ + fn from_iter>(iter: I) -> Self { + let mut res = <(A, B)>::default(); + res.extend(iter); + + res + } +} + /// Conversion into an [`Iterator`]. /// /// By implementing `IntoIterator` for a type, you define how it will be