about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlexis <a.beingessner@gmail.com>2015-02-18 13:06:21 -0500
committerAlexis <a.beingessner@gmail.com>2015-02-18 14:01:47 -0500
commit66613e26b95438c02e2f5c273c557515454121f7 (patch)
treeed2b84cfeb042660366256e38010adb0eb5bc272 /src/libsyntax
parent4a9d190423f67a00053f4b5c9869f0ccbdfcc689 (diff)
downloadrust-66613e26b95438c02e2f5c273c557515454121f7.tar.gz
rust-66613e26b95438c02e2f5c273c557515454121f7.zip
make FromIterator use IntoIterator
This breaks all implementors of FromIterator, as they must now accept IntoIterator instead of Iterator. The fix for this is generally trivial (change the bound, and maybe call into_iter() on the argument to get the old argument).

Users of FromIterator should be unaffected because Iterators are IntoIterator.

[breaking-change]
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/owned_slice.rs6
-rw-r--r--src/libsyntax/util/small_vector.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs
index 0f9a56baa17..f5201d4a8bc 100644
--- a/src/libsyntax/owned_slice.rs
+++ b/src/libsyntax/owned_slice.rs
@@ -10,7 +10,7 @@
 
 use std::default::Default;
 use std::fmt;
-use std::iter::FromIterator;
+use std::iter::{IntoIterator, FromIterator};
 use std::ops::Deref;
 use std::vec;
 use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -77,8 +77,8 @@ impl<T: Clone> Clone for OwnedSlice<T> {
 }
 
 impl<T> FromIterator<T> for OwnedSlice<T> {
-    fn from_iter<I: Iterator<Item=T>>(iter: I) -> OwnedSlice<T> {
-        OwnedSlice::from_vec(iter.collect())
+    fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> OwnedSlice<T> {
+        OwnedSlice::from_vec(iter.into_iter().collect())
     }
 }
 
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs
index 6a1fb4008ad..0a39d380904 100644
--- a/src/libsyntax/util/small_vector.rs
+++ b/src/libsyntax/util/small_vector.rs
@@ -30,7 +30,7 @@ enum SmallVectorRepr<T> {
 }
 
 impl<T> FromIterator<T> for SmallVector<T> {
-    fn from_iter<I: Iterator<Item=T>>(iter: I) -> SmallVector<T> {
+    fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> SmallVector<T> {
         let mut v = SmallVector::zero();
         v.extend(iter);
         v