diff options
| author | The 8472 <git@infinite-source.de> | 2022-10-25 22:55:04 +0200 |
|---|---|---|
| committer | The 8472 <git@infinite-source.de> | 2023-02-28 21:00:01 +0100 |
| commit | a4bdfe24c5f83cbb03febdb9ab5fd22414eac05f (patch) | |
| tree | 7ee8d4a82b299eea7c480b7dbb58511ab6f2fc98 /library/alloc/src/vec | |
| parent | 2b32b315f91536b32ac60ea0d3a93a1feb1d9215 (diff) | |
| download | rust-a4bdfe24c5f83cbb03febdb9ab5fd22414eac05f.tar.gz rust-a4bdfe24c5f83cbb03febdb9ab5fd22414eac05f.zip | |
Support allocators in various Default for IntoIter impls
Global implements Default so we can use that as bound for all allocators
Diffstat (limited to 'library/alloc/src/vec')
| -rw-r--r-- | library/alloc/src/vec/into_iter.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 8fed4a584a3..f6525eb9003 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -348,7 +348,10 @@ impl<T, A: Allocator> FusedIterator for IntoIter<T, A> {} unsafe impl<T, A: Allocator> TrustedLen for IntoIter<T, A> {} #[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] -impl<T> Default for IntoIter<T> { +impl<T, A> Default for IntoIter<T, A> +where + A: Allocator + Default, +{ /// Creates an empty `vec::IntoIter`. /// /// ``` @@ -358,7 +361,7 @@ impl<T> Default for IntoIter<T> { /// assert_eq!(iter.as_slice(), &[]); /// ``` fn default() -> Self { - super::Vec::new().into_iter() + super::Vec::new_in(Default::default()).into_iter() } } |
