Skip to content

Iterator reform broke reimplementations of methods now in IteratorExt #19435

Closed
@skade

Description

@skade

Recently, Iterator was split into Iterator and IteratorExt, with an implementation impl<A, I: Iterator<A>> IteratorExt<A> for I.

I have an Iterator that implements last (as the underlying C-API has an efficient implementation for seeking), which now broke:

/home/vagrant/leveldb/src/database/iterator.rs:301:1: 306:2 error: conflicting implementations for trait `core::iter::IteratorExt` [E0119]
/home/vagrant/leveldb/src/database/iterator.rs:301 impl<'a, K: Key> iter::IteratorExt<Vec<u8>> for ValueIterator<'a,K,Vec<u8>> {
/home/vagrant/leveldb/src/database/iterator.rs:302   fn last(&mut self) -> Option<Vec<u8>> {
/home/vagrant/leveldb/src/database/iterator.rs:303      self.seek_last();
/home/vagrant/leveldb/src/database/iterator.rs:304      Some(self.value())
/home/vagrant/leveldb/src/database/iterator.rs:305   }
/home/vagrant/leveldb/src/database/iterator.rs:306 }
/home/vagrant/leveldb/src/database/iterator.rs:301:1: 306:2 note: conflicting implementation in crate `core`
/home/vagrant/leveldb/src/database/iterator.rs:301 impl<'a, K: Key> iter::IteratorExt<Vec<u8>> for ValueIterator<'a,K,Vec<u8>> {
/home/vagrant/leveldb/src/database/iterator.rs:302   fn last(&mut self) -> Option<Vec<u8>> {
/home/vagrant/leveldb/src/database/iterator.rs:303      self.seek_last();
/home/vagrant/leveldb/src/database/iterator.rs:304      Some(self.value())
/home/vagrant/leveldb/src/database/iterator.rs:305   }
/home/vagrant/leveldb/src/database/iterator.rs:306 }

The error is expected, but I'd expect that IteratorExt methods can be reimplemented like all others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions