From 6b19a02080b816d0f416872e63f9b2dd90165c0f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 1 Jan 2015 22:55:09 -0500 Subject: [PATCH] syntax: fix fallout --- src/libsyntax/ast_map/mod.rs | 14 ++++++++++---- src/libsyntax/attr.rs | 2 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/owned_slice.rs | 2 +- src/libsyntax/parse/mod.rs | 2 +- src/libsyntax/util/small_vector.rs | 8 +++++--- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index b5395d09ca7..b1799fc2718 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -61,7 +61,9 @@ struct LinkedPathNode<'a> { type LinkedPath<'a> = Option<&'a LinkedPathNode<'a>>; -impl<'a> Iterator for LinkedPath<'a> { +impl<'a> Iterator for LinkedPath<'a> { + type Item = PathElem; + fn next(&mut self) -> Option { match *self { Some(node) => { @@ -77,7 +79,9 @@ fn next(&mut self) -> Option { #[deriving(Clone)] pub struct Values<'a, T:'a>(pub slice::Iter<'a, T>); -impl<'a, T: Copy> Iterator for Values<'a, T> { +impl<'a, T: Copy> Iterator for Values<'a, T> { + type Item = T; + fn next(&mut self) -> Option { let &Values(ref mut items) = self; items.next().map(|&x| x) @@ -87,7 +91,7 @@ fn next(&mut self) -> Option { /// The type of the iterator used by with_path. pub type PathElems<'a, 'b> = iter::Chain, LinkedPath<'b>>; -pub fn path_to_string>(path: PI) -> String { +pub fn path_to_string>(path: PI) -> String { let itr = token::get_ident_interner(); path.fold(String::new(), |mut s, e| { @@ -629,7 +633,9 @@ fn matches_names(&self, parent_of_n: NodeId, name: Name) -> bool { } } -impl<'a, 'ast> Iterator for NodesMatchingSuffix<'a, 'ast> { +impl<'a, 'ast> Iterator for NodesMatchingSuffix<'a, 'ast> { + type Item = NodeId; + fn next(&mut self) -> Option { loop { let idx = self.idx; diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index df820b40cb6..92818f06341 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -359,7 +359,7 @@ pub enum StabilityLevel { pub fn find_stability_generic<'a, AM: AttrMetaMethods, - I: Iterator<&'a AM>> + I: Iterator> (mut attrs: I) -> Option<(Stability, &'a AM)> { for attr in attrs { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index efb4867a016..e56194c95cd 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -220,7 +220,7 @@ pub struct MacItems { } impl MacItems { - pub fn new>>(it: I) -> Box { + pub fn new>>(it: I) -> Box { box MacItems { items: it.collect() } as Box } } diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs index bc2e0923115..38c26e89671 100644 --- a/src/libsyntax/owned_slice.rs +++ b/src/libsyntax/owned_slice.rs @@ -77,7 +77,7 @@ fn clone(&self) -> OwnedSlice { } impl FromIterator for OwnedSlice { - fn from_iter>(iter: I) -> OwnedSlice { + fn from_iter>(iter: I) -> OwnedSlice { OwnedSlice::from_vec(iter.collect()) } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 88c485a07ac..8598571e5c3 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -598,7 +598,7 @@ pub fn binary_lit(lit: &str) -> Rc> { let error = |&: i| format!("lexer should have rejected {} at {}", lit, i); /// Eat everything up to a non-whitespace - fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) { + fn eat<'a, I: Iterator>(it: &mut iter::Peekable<(uint, u8), I>) { loop { match it.peek().map(|x| x.1) { Some(b' ') | Some(b'\n') | Some(b'\r') | Some(b'\t') => { diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 953a7ae960e..b68c9926391 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -30,7 +30,7 @@ enum SmallVectorRepr { } impl FromIterator for SmallVector { - fn from_iter>(iter: I) -> SmallVector { + fn from_iter>(iter: I) -> SmallVector { let mut v = SmallVector::zero(); v.extend(iter); v @@ -38,7 +38,7 @@ fn from_iter>(iter: I) -> SmallVector { } impl Extend for SmallVector { - fn extend>(&mut self, mut iter: I) { + fn extend>(&mut self, mut iter: I) { for val in iter { self.push(val); } @@ -147,7 +147,9 @@ enum IntoIterRepr { ManyIterator(vec::IntoIter), } -impl Iterator for IntoIter { +impl Iterator for IntoIter { + type Item = T; + fn next(&mut self) -> Option { match self.repr { ZeroIterator => None,