]> git.lizzy.rs Git - rust.git/commitdiff
Implement Iterator::size_hint for Elaborator.
authorCorey Farwell <coreyf@rwell.org>
Mon, 30 Jul 2018 13:07:51 +0000 (09:07 -0400)
committerCorey Farwell <coreyf@rwell.org>
Fri, 17 Aug 2018 04:27:08 +0000 (21:27 -0700)
src/librustc/traits/util.rs

index 875c7199f6d11830e1179b19ad5b7afc0db0dced..40f13ac06f56fbed1439d69e2df4f9793004bafc 100644 (file)
@@ -239,6 +239,10 @@ fn push(&mut self, predicate: &ty::Predicate<'tcx>) {
 impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> {
     type Item = ty::Predicate<'tcx>;
 
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (self.stack.len(), None)
+    }
+
     fn next(&mut self) -> Option<ty::Predicate<'tcx>> {
         // Extract next item from top-most stack frame, if any.
         let next_predicate = match self.stack.pop() {