diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index 8cb0447e732..e20968a9ac9 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -18,6 +18,7 @@ use util::ppaux::Repr; use std::fmt; +use std::iter::IntoIterator; use std::slice::Iter; use std::vec::{Vec, IntoIter}; use syntax::codemap::{Span, DUMMY_SP}; @@ -529,6 +530,23 @@ fn next(&mut self) -> Option<(ParamSpace, uint, &'a T)> { } } +impl IntoIterator for VecPerParamSpace { + type IntoIter = IntoIter; + + fn into_iter(self) -> IntoIter { + self.into_vec().into_iter() + } +} + +impl<'a,T> IntoIterator for &'a VecPerParamSpace { + type IntoIter = Iter<'a, T>; + + fn into_iter(self) -> Iter<'a, T> { + self.as_slice().into_iter() + } +} + + /////////////////////////////////////////////////////////////////////////// // Public trait `Subst` //