From adfb4167ef0f466dad54f18c74ac45e0c664b324 Mon Sep 17 00:00:00 2001 From: Peter Kehl Date: Thu, 5 Jan 2023 18:05:07 -0800 Subject: [PATCH] Working around ICE rust-lang/rust issue #106473. WIP --- library/alloc/src/collections/binary_heap/mod.rs | 2 +- library/alloc/src/ffi/c_str.rs | 2 +- library/alloc/src/vec/in_place_collect.rs | 2 +- library/alloc/src/vec/mod.rs | 12 ++++++------ library/alloc/src/vec/spec_from_iter.rs | 4 ++-- library/alloc/src/vec/spec_from_iter_nested.rs | 4 ++-- library/proc_macro/src/bridge/mod.rs | 4 ++-- library/proc_macro/src/bridge/rpc.rs | 4 ++-- library/proc_macro/src/diagnostic.rs | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index f1b0cc4a72424..0a4a52e25c48f 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -1652,7 +1652,7 @@ impl From<[T; N]> for BinaryHeap { } #[stable(feature = "binary_heap_extras_15", since = "1.5.0")] -impl From> for Vec { +impl From> for Vec { /// Converts a `BinaryHeap` into a `Vec`. /// /// This conversion requires no data movement or allocation, and has diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 11bd4c4dc1ba8..5948995f90c13 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -723,7 +723,7 @@ impl fmt::Debug for CString { } #[stable(feature = "cstring_into", since = "1.7.0")] -impl From for Vec { +impl From for Vec { /// Converts a [`CString`] into a [Vec]<[u8]>. /// /// The conversion consumes the [`CString`], and removes the terminating NUL byte. diff --git a/library/alloc/src/vec/in_place_collect.rs b/library/alloc/src/vec/in_place_collect.rs index 87d61deb1eb2f..cdaf3c43e824d 100644 --- a/library/alloc/src/vec/in_place_collect.rs +++ b/library/alloc/src/vec/in_place_collect.rs @@ -150,7 +150,7 @@ pub(super) trait InPlaceIterableMarker {} impl InPlaceIterableMarker for T where T: InPlaceIterable {} -impl SpecFromIter for Vec +impl SpecFromIter for Vec where I: Iterator + SourceIter + InPlaceIterableMarker, { diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index b92d2da5a6693..74784a09e4edb 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2868,7 +2868,7 @@ where #[cfg(not(no_global_oom_handling))] #[stable(feature = "rust1", since = "1.0.0")] -impl FromIterator for Vec { +impl FromIterator for Vec { #[inline] fn from_iter>(iter: I) -> Vec { >::from_iter(iter.into_iter()) @@ -3286,7 +3286,7 @@ where #[cfg(not(no_global_oom_handling))] #[stable(feature = "rust1", since = "1.0.0")] -impl From<&[T]> for Vec { +impl From<&[T]> for Vec { /// Allocate a `Vec` and fill it by cloning `s`'s items. /// /// # Examples @@ -3306,7 +3306,7 @@ impl From<&[T]> for Vec { #[cfg(not(no_global_oom_handling))] #[stable(feature = "vec_from_mut", since = "1.19.0")] -impl From<&mut [T]> for Vec { +impl From<&mut [T]> for Vec { /// Allocate a `Vec` and fill it by cloning `s`'s items. /// /// # Examples @@ -3326,7 +3326,7 @@ impl From<&mut [T]> for Vec { #[cfg(not(no_global_oom_handling))] #[stable(feature = "vec_from_array", since = "1.44.0")] -impl From<[T; N]> for Vec { +impl From<[T; N]> for Vec { /// Allocate a `Vec` and move `s`'s items into it. /// /// # Examples @@ -3349,7 +3349,7 @@ impl From<[T; N]> for Vec { } #[stable(feature = "vec_from_cow_slice", since = "1.14.0")] -impl<'a, T> From> for Vec +impl<'a, T> From> for Vec where [T]: ToOwned>, { @@ -3426,7 +3426,7 @@ where #[cfg(not(no_global_oom_handling))] #[stable(feature = "rust1", since = "1.0.0")] -impl From<&str> for Vec { +impl From<&str> for Vec { /// Allocate a `Vec` and fill it with a UTF-8 string. /// /// # Examples diff --git a/library/alloc/src/vec/spec_from_iter.rs b/library/alloc/src/vec/spec_from_iter.rs index efa6868473e49..7db120f1ff6c2 100644 --- a/library/alloc/src/vec/spec_from_iter.rs +++ b/library/alloc/src/vec/spec_from_iter.rs @@ -25,7 +25,7 @@ pub(super) trait SpecFromIter { fn from_iter(iter: I) -> Self; } -impl SpecFromIter for Vec +impl SpecFromIter for Vec where I: Iterator, { @@ -34,7 +34,7 @@ where } } -impl SpecFromIter> for Vec { +impl SpecFromIter> for Vec { fn from_iter(iterator: IntoIter) -> Self { // A common case is passing a vector into a function which immediately // re-collects into a vector. We can short circuit this if the IntoIter diff --git a/library/alloc/src/vec/spec_from_iter_nested.rs b/library/alloc/src/vec/spec_from_iter_nested.rs index f915ebb86e5a5..9453f2dcd9828 100644 --- a/library/alloc/src/vec/spec_from_iter_nested.rs +++ b/library/alloc/src/vec/spec_from_iter_nested.rs @@ -13,7 +13,7 @@ pub(super) trait SpecFromIterNested { fn from_iter(iter: I) -> Self; } -impl SpecFromIterNested for Vec +impl SpecFromIterNested for Vec where I: Iterator, { @@ -45,7 +45,7 @@ where } } -impl SpecFromIterNested for Vec +impl SpecFromIterNested for Vec where I: TrustedLen, { diff --git a/library/proc_macro/src/bridge/mod.rs b/library/proc_macro/src/bridge/mod.rs index 4c1e196b5ad16..aae141dc2a118 100644 --- a/library/proc_macro/src/bridge/mod.rs +++ b/library/proc_macro/src/bridge/mod.rs @@ -252,14 +252,14 @@ impl<'a, T, M> Unmark for &'a mut Marked { } } -impl Mark for Vec { +impl Mark for Vec { type Unmarked = Vec; fn mark(unmarked: Self::Unmarked) -> Self { // Should be a no-op due to std's in-place collect optimizations. unmarked.into_iter().map(T::mark).collect() } } -impl Unmark for Vec { +impl Unmark for Vec { type Unmarked = Vec; fn unmark(self) -> Self::Unmarked { // Should be a no-op due to std's in-place collect optimizations. diff --git a/library/proc_macro/src/bridge/rpc.rs b/library/proc_macro/src/bridge/rpc.rs index e9d7a46c06f6d..c50eb9c620626 100644 --- a/library/proc_macro/src/bridge/rpc.rs +++ b/library/proc_macro/src/bridge/rpc.rs @@ -225,7 +225,7 @@ impl DecodeMut<'_, '_, S> for String { } } -impl> Encode for Vec { +impl> Encode for Vec { fn encode(self, w: &mut Writer, s: &mut S) { self.len().encode(w, s); for x in self { @@ -234,7 +234,7 @@ impl> Encode for Vec { } } -impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec { +impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec { fn decode(r: &mut Reader<'a>, s: &mut S) -> Self { let len = usize::decode(r, s); let mut vec = Vec::with_capacity(len); diff --git a/library/proc_macro/src/diagnostic.rs b/library/proc_macro/src/diagnostic.rs index 5a209f7c7aa18..41a11b1003b84 100644 --- a/library/proc_macro/src/diagnostic.rs +++ b/library/proc_macro/src/diagnostic.rs @@ -30,7 +30,7 @@ impl MultiSpan for Span { } #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] -impl MultiSpan for Vec { +impl MultiSpan for Vec { fn into_spans(self) -> Vec { self }