about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2019-03-24 15:32:52 +0800
committerkennytm <kennytm@gmail.com>2019-03-24 19:00:10 +0800
commitcb2dde63d5cdcee619ad65de79029629ccee7604 (patch)
tree8872664023450cea7a751b0f445e63e2b60379d2 /src/liballoc
parent1d286f7918307f1b2bfa9a157070cc99c0465f30 (diff)
parent739ba0417ae6477ffc9c5e8298b5075725d52420 (diff)
downloadrust-cb2dde63d5cdcee619ad65de79029629ccee7604.tar.gz
rust-cb2dde63d5cdcee619ad65de79029629ccee7604.zip
Rollup merge of #59328 - koalatux:iter-nth-back, r=scottmcm
Implement specialized nth_back() for Box and Windows.

Hi there, this is my first pull request to rust :-)

I started implementing some specializations for DoubleEndedIterator::nth_back() and these are the first two. The problem has been discussed in #54054 and nth_back() is tracked in #56995.

I'm stuck with the next implementation so I though I do a PR for the ones I'm confident with to get some feedback.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs3
-rw-r--r--src/liballoc/lib.rs1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 9bce142b483..b2315c6a739 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -677,6 +677,9 @@ impl<I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<I> {
     fn next_back(&mut self) -> Option<I::Item> {
         (**self).next_back()
     }
+    fn nth_back(&mut self, n: usize) -> Option<I::Item> {
+        (**self).nth_back(n)
+    }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 440ce8ac5e8..90ff56814fb 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -115,6 +115,7 @@
 #![feature(maybe_uninit, maybe_uninit_slice, maybe_uninit_array)]
 #![feature(alloc_layout_extra)]
 #![feature(try_trait)]
+#![feature(iter_nth_back)]
 
 // Allow testing this library