From 05c7330ca03650bbcb6a55f5fa490b3bb03c1940 Mon Sep 17 00:00:00 2001 From: The 8472 Date: Sat, 30 Jul 2022 01:48:16 +0200 Subject: Implement Default for some alloc/core iterators This way one can `mem::take()` them out of structs or #[derive(Default)] on structs containing them. These changes will be insta-stable. --- library/alloc/src/collections/binary_heap/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'library/alloc/src/collections/binary_heap') diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index f1d0a305d99..b0ec70ad565 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -1468,6 +1468,13 @@ impl ExactSizeIterator for IntoIter { #[stable(feature = "fused", since = "1.26.0")] impl FusedIterator for IntoIter {} +#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +impl Default for IntoIter { + fn default() -> Self { + IntoIter { iter: Default::default() } + } +} + // In addition to the SAFETY invariants of the following three unsafe traits // also refer to the vec::in_place_collect module documentation to get an overview #[unstable(issue = "none", feature = "inplace_iteration")] -- cgit 1.4.1-3-g733a5