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.
This commit is contained in:
The 8472 2022-07-30 01:48:16 +02:00
parent 31f858d9a5
commit 05c7330ca0
18 changed files with 243 additions and 2 deletions

View file

@ -393,6 +393,13 @@ macro_rules! iterator {
}
}
}
#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<T> Default for $name<'_, T> {
fn default() -> Self {
(& $( $mut_ )? []).into_iter()
}
}
}
}