Skip to content

Commit

Permalink
Working around ICE rust-lang/rust issue rust-lang#106473. WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-lyons-kehl committed Jan 19, 2023
1 parent 738d4f4 commit adfb416
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion library/alloc/src/collections/binary_heap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ impl<T: Ord, const N: usize> From<[T; N]> for BinaryHeap<T> {
}

#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
impl<T> From<BinaryHeap<T>> for Vec<T> {
impl<T> From<BinaryHeap<T>> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
/// Converts a `BinaryHeap<T>` into a `Vec<T>`.
///
/// This conversion requires no data movement or allocation, and has
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ impl fmt::Debug for CString {
}

#[stable(feature = "cstring_into", since = "1.7.0")]
impl From<CString> for Vec<u8> {
impl From<CString> for Vec<u8, Global, DEFAULT_COOP_PREFERRED> {
/// Converts a [`CString`] into a <code>[Vec]<[u8]></code>.
///
/// The conversion consumes the [`CString`], and removes the terminating NUL byte.
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/vec/in_place_collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub(super) trait InPlaceIterableMarker {}

impl<T> InPlaceIterableMarker for T where T: InPlaceIterable {}

impl<T, I> SpecFromIter<T, I> for Vec<T>
impl<T, I> SpecFromIter<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
where
I: Iterator<Item = T> + SourceIter<Source: AsVecIntoIter> + InPlaceIterableMarker,
{
Expand Down
12 changes: 6 additions & 6 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2868,7 +2868,7 @@ where

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> FromIterator<T> for Vec<T> {
impl<T> FromIterator<T> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
#[inline]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Vec<T> {
<Self as SpecFromIter<T, I::IntoIter>>::from_iter(iter.into_iter())
Expand Down Expand Up @@ -3286,7 +3286,7 @@ where

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Clone> From<&[T]> for Vec<T> {
impl<T: Clone> From<&[T]> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
/// Allocate a `Vec<T>` and fill it by cloning `s`'s items.
///
/// # Examples
Expand All @@ -3306,7 +3306,7 @@ impl<T: Clone> From<&[T]> for Vec<T> {

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "vec_from_mut", since = "1.19.0")]
impl<T: Clone> From<&mut [T]> for Vec<T> {
impl<T: Clone> From<&mut [T]> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
/// Allocate a `Vec<T>` and fill it by cloning `s`'s items.
///
/// # Examples
Expand All @@ -3326,7 +3326,7 @@ impl<T: Clone> From<&mut [T]> for Vec<T> {

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "vec_from_array", since = "1.44.0")]
impl<T, const N: usize> From<[T; N]> for Vec<T> {
impl<T, const N: usize> From<[T; N]> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
/// Allocate a `Vec<T>` and move `s`'s items into it.
///
/// # Examples
Expand All @@ -3349,7 +3349,7 @@ impl<T, const N: usize> From<[T; N]> for Vec<T> {
}

#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
impl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
where
[T]: ToOwned<Owned = Vec<T>>,
{
Expand Down Expand Up @@ -3426,7 +3426,7 @@ where

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
impl From<&str> for Vec<u8> {
impl From<&str> for Vec<u8, Global, DEFAULT_COOP_PREFERRED> {
/// Allocate a `Vec<u8>` and fill it with a UTF-8 string.
///
/// # Examples
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/vec/spec_from_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(super) trait SpecFromIter<T, I> {
fn from_iter(iter: I) -> Self;
}

impl<T, I> SpecFromIter<T, I> for Vec<T>
impl<T, I> SpecFromIter<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
where
I: Iterator<Item = T>,
{
Expand All @@ -34,7 +34,7 @@ where
}
}

impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T> {
impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
fn from_iter(iterator: IntoIter<T>) -> 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
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/vec/spec_from_iter_nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub(super) trait SpecFromIterNested<T, I> {
fn from_iter(iter: I) -> Self;
}

impl<T, I> SpecFromIterNested<T, I> for Vec<T>
impl<T, I> SpecFromIterNested<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
where
I: Iterator<Item = T>,
{
Expand Down Expand Up @@ -45,7 +45,7 @@ where
}
}

impl<T, I> SpecFromIterNested<T, I> for Vec<T>
impl<T, I> SpecFromIterNested<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
where
I: TrustedLen<Item = T>,
{
Expand Down
4 changes: 2 additions & 2 deletions library/proc_macro/src/bridge/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ impl<'a, T, M> Unmark for &'a mut Marked<T, M> {
}
}

impl<T: Mark> Mark for Vec<T> {
impl<T: Mark> Mark for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
type Unmarked = Vec<T::Unmarked>;
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<T: Unmark> Unmark for Vec<T> {
impl<T: Unmark> Unmark for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
type Unmarked = Vec<T::Unmarked>;
fn unmark(self) -> Self::Unmarked {
// Should be a no-op due to std's in-place collect optimizations.
Expand Down
4 changes: 2 additions & 2 deletions library/proc_macro/src/bridge/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl<S> DecodeMut<'_, '_, S> for String {
}
}

impl<S, T: Encode<S>> Encode<S> for Vec<T> {
impl<S, T: Encode<S>> Encode<S> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
fn encode(self, w: &mut Writer, s: &mut S) {
self.len().encode(w, s);
for x in self {
Expand All @@ -234,7 +234,7 @@ impl<S, T: Encode<S>> Encode<S> for Vec<T> {
}
}

impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec<T> {
impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
let len = usize::decode(r, s);
let mut vec = Vec::with_capacity(len);
Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl MultiSpan for Span {
}

#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
impl MultiSpan for Vec<Span> {
impl MultiSpan for Vec<Span, Global, DEFAULT_COOP_PREFERRED> {
fn into_spans(self) -> Vec<Span> {
self
}
Expand Down

0 comments on commit adfb416

Please sign in to comment.