diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 28f4dda14088..6d7a9b1d1f9d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -532,7 +532,14 @@ impl DoubleEndedIterator for Box { } } #[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Box {} +impl ExactSizeIterator for Box { + fn len(&self) -> usize { + (**self).len() + } + fn is_empty(&self) -> bool { + (**self).is_empty() + } +} #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for Box {} diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 0d450184ed87..acce4ce03589 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -79,6 +79,7 @@ #![feature(core_intrinsics)] #![feature(custom_attribute)] #![feature(dropck_parametricity)] +#![cfg_attr(not(test), feature(exact_size_is_empty))] #![feature(fundamental)] #![feature(lang_items)] #![feature(needs_allocator)]