Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/librustc/middle/subst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,11 @@ impl<'a,T> Iterator for EnumeratedItems<'a,T> {
None
}
}

fn size_hint(&self) -> (usize, Option<usize>) {
let size = self.vec.as_slice().len();
(size, Some(size))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overestimates the number of elements in the iterator, doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't. The underlying vector is used in its entirety. If you check VecPerParamSpace::limits() one can see how it is split into three consecutive ranges.

(We discussed this on IRC, I'm just adding this comment for reference.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now understand the iterator! It's fine. We cleared this up on irc.

}
}

impl<T> IntoIterator for VecPerParamSpace<T> {
Expand Down