Fun with associated types, Iterator, and IntoIterator #23069
Labels
A-associated-items
Area: Associated items (types, constants & functions)
I-compiletime
Issue: Problems and improvements with respect to compile times.
(The following is a reduced example)
I have a composite two-level structure which I want to iterate. This involves iterating the first level to obtain blocks of the second level, which are in turn iterated. We would like to update this code to use associated types.
My first attempt is as follows:
but this errors out with:
Which doesn't make any sense to me. It looks like it might be a bug. Still, it's easily resolved by making the change in the comment: adding
Item=VecDequeIter::Item
to the IntoIterator bound solves this.I then notice that actually VecDequeIter need not be a generic argument, it follows from DListIter. Ok, let's do that:
Ignoring the apparently necessary
as IntoIterator
's, this triggers some clearly exponential behaviour in the coherence checker:The text was updated successfully, but these errors were encountered: