From 2cd5030ef592a2d4094145060c031dcae66e624f Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 18 Sep 2019 00:09:19 +0200 Subject: Deny specializing items not in the parent impl --- src/liballoc/boxed.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/liballoc') 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 Iterator for Box { fn nth(&mut self, n: usize) -> Option { (**self).nth(n) } + default fn last(self) -> Option { + let mut last = None; + for x in self { last = Some(x); } + last + } } #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5