about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2019-09-18 00:09:19 +0200
committerJonas Schievink <jonasschievink@gmail.com>2019-10-05 15:33:24 +0200
commit2cd5030ef592a2d4094145060c031dcae66e624f (patch)
treef1b85142ec44701b7d1440281682cfceb0c42df4 /src/liballoc
parent2e7244807a7878f6eca3eb7d97ae9b413aa49014 (diff)
downloadrust-2cd5030ef592a2d4094145060c031dcae66e624f.tar.gz
rust-2cd5030ef592a2d4094145060c031dcae66e624f.zip
Deny specializing items not in the parent impl
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index b2789a535fe..adbc0e6ba2c 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -871,6 +871,11 @@ impl<I: Iterator + ?Sized> Iterator for Box<I> {
     fn nth(&mut self, n: usize) -> Option<I::Item> {
         (**self).nth(n)
     }
+    default fn last(self) -> Option<I::Item> {
+        let mut last = None;
+        for x in self { last = Some(x); }
+        last
+    }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]