diff options
| author | Ulrik Sverdrup <bluss@users.noreply.github.com> | 2016-12-02 21:13:57 +0100 |
|---|---|---|
| committer | Ulrik Sverdrup <bluss@users.noreply.github.com> | 2016-12-02 21:20:41 +0100 |
| commit | bc3618e5c007e69e6b21b2aa4d2aad110da6655e (patch) | |
| tree | 9582ce154baf0846883139b84acd0a2ec03de30c /src/liballoc | |
| parent | 73e98a0210f0afdec28b4f5bc0f7327d6a5a8555 (diff) | |
| download | rust-bc3618e5c007e69e6b21b2aa4d2aad110da6655e.tar.gz rust-bc3618e5c007e69e6b21b2aa4d2aad110da6655e.zip | |
core: Remove Self: Sized from Iterator::nth
It is an unnecessary restriction; nth neither needs self to be sized nor needs to be exempted from the trait object. It increases the utility of the nth method, because type specific implementations are available through `&mut I` or through an iterator trait object. It is a backwards compatible change due to the special cases of the `where Self: Sized` bound; it was already optional to include this bound in `Iterator` implementations.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 28f4dda1408..d10d7a5e58d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -524,6 +524,9 @@ impl<I: Iterator + ?Sized> Iterator for Box<I> { fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() } + fn nth(&mut self, n: usize) -> Option<I::Item> { + (**self).nth(n) + } } #[stable(feature = "rust1", since = "1.0.0")] impl<I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<I> { |
