From 6264c24a1b8737b7535aec904d9837f0f8037446 Mon Sep 17 00:00:00 2001 From: Peter Kehl Date: Mon, 12 Dec 2022 21:42:54 -0800 Subject: [PATCH] Vec/VecDeque to use COOP_PREFERRED. WIP, NOT COMPILING. But: rustc doesn't die anymore. --- library/alloc/src/collections/vec_deque/mod.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 495cbf05f27ba..a6f2631c3fd33 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -158,7 +158,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl Default for VecDeque { +impl Default for VecDeque { /// Creates an empty deque. #[inline] fn default() -> VecDeque { @@ -547,7 +547,7 @@ where } } -impl VecDeque +impl VecDeque where [(); alloc::co_alloc_metadata_num_slots_with_preference::(COOP_PREFERRED)]:, { @@ -564,7 +564,7 @@ where #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[must_use] - pub fn new() -> VecDeque { + pub fn new() -> VecDeque { VecDeque::new_in(Global) } @@ -580,7 +580,7 @@ where #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[must_use] - pub fn with_capacity(capacity: usize) -> VecDeque { + pub fn with_capacity(capacity: usize) -> VecDeque { Self::with_capacity_in(capacity, Global) } } @@ -2788,7 +2788,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl FromIterator for VecDeque +impl FromIterator for VecDeque where [(); alloc::co_alloc_metadata_num_slots_with_preference::(COOP_PREFERRED)]:, { @@ -2973,8 +2973,8 @@ where } #[stable(feature = "std_collections_from_array", since = "1.56.0")] -impl From<[T; N]> - for VecDeque +impl + From<[T; N]> for VecDeque where [(); alloc::co_alloc_metadata_num_slots_with_preference::(COOP_PREFERRED)]:, { @@ -2993,6 +2993,7 @@ where if !::IS_ZST { // SAFETY: VecDeque::with_capacity ensures that there is enough capacity. unsafe { + // @FIXME for COOP_PREFERRED: ptr::copy_nonoverlapping(arr.as_ptr(), deq.ptr(), N); } }