Skip to content

Commit 20d65d6

Browse files
CoAlloc: Vec: Working around ICE rust-lang/rust issue rust-lang#106473 ICE. WIP
1 parent 3103f87 commit 20d65d6

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

library/alloc/src/vec/in_place_collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub(super) trait InPlaceIterableMarker {}
150150

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

153-
impl<T, I> SpecFromIter<T, I> for Vec<T>
153+
impl<T, I> SpecFromIter<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
154154
where
155155
I: Iterator<Item = T> + SourceIter<Source: AsVecIntoIter> + InPlaceIterableMarker,
156156
{

library/alloc/src/vec/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,7 @@ where
28682868

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

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

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

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

33513351
#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
3352-
impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
3352+
impl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
33533353
where
33543354
[T]: ToOwned<Owned = Vec<T>>,
33553355
{
@@ -3426,7 +3426,7 @@ where
34263426

34273427
#[cfg(not(no_global_oom_handling))]
34283428
#[stable(feature = "rust1", since = "1.0.0")]
3429-
impl From<&str> for Vec<u8> {
3429+
impl From<&str> for Vec<u8, Global, DEFAULT_COOP_PREFERRED> {
34303430
/// Allocate a `Vec<u8>` and fill it with a UTF-8 string.
34313431
///
34323432
/// # Examples

library/alloc/src/vec/spec_from_iter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(super) trait SpecFromIter<T, I> {
2525
fn from_iter(iter: I) -> Self;
2626
}
2727

28-
impl<T, I> SpecFromIter<T, I> for Vec<T>
28+
impl<T, I> SpecFromIter<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
2929
where
3030
I: Iterator<Item = T>,
3131
{
@@ -34,7 +34,7 @@ where
3434
}
3535
}
3636

37-
impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T> {
37+
impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
3838
fn from_iter(iterator: IntoIter<T>) -> Self {
3939
// A common case is passing a vector into a function which immediately
4040
// re-collects into a vector. We can short circuit this if the IntoIter

library/alloc/src/vec/spec_from_iter_nested.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(super) trait SpecFromIterNested<T, I> {
1313
fn from_iter(iter: I) -> Self;
1414
}
1515

16-
impl<T, I> SpecFromIterNested<T, I> for Vec<T>
16+
impl<T, I> SpecFromIterNested<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
1717
where
1818
I: Iterator<Item = T>,
1919
{
@@ -45,7 +45,7 @@ where
4545
}
4646
}
4747

48-
impl<T, I> SpecFromIterNested<T, I> for Vec<T>
48+
impl<T, I> SpecFromIterNested<T, I> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
4949
where
5050
I: TrustedLen<Item = T>,
5151
{

library/proc_macro/src/bridge/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,14 @@ impl<'a, T, M> Unmark for &'a mut Marked<T, M> {
252252
}
253253
}
254254

255-
impl<T: Mark> Mark for Vec<T> {
255+
impl<T: Mark> Mark for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
256256
type Unmarked = Vec<T::Unmarked>;
257257
fn mark(unmarked: Self::Unmarked) -> Self {
258258
// Should be a no-op due to std's in-place collect optimizations.
259259
unmarked.into_iter().map(T::mark).collect()
260260
}
261261
}
262-
impl<T: Unmark> Unmark for Vec<T> {
262+
impl<T: Unmark> Unmark for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
263263
type Unmarked = Vec<T::Unmarked>;
264264
fn unmark(self) -> Self::Unmarked {
265265
// Should be a no-op due to std's in-place collect optimizations.

library/proc_macro/src/bridge/rpc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<S> DecodeMut<'_, '_, S> for String {
225225
}
226226
}
227227

228-
impl<S, T: Encode<S>> Encode<S> for Vec<T> {
228+
impl<S, T: Encode<S>> Encode<S> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
229229
fn encode(self, w: &mut Writer, s: &mut S) {
230230
self.len().encode(w, s);
231231
for x in self {
@@ -234,7 +234,7 @@ impl<S, T: Encode<S>> Encode<S> for Vec<T> {
234234
}
235235
}
236236

237-
impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec<T> {
237+
impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
238238
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
239239
let len = usize::decode(r, s);
240240
let mut vec = Vec::with_capacity(len);

library/proc_macro/src/diagnostic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl MultiSpan for Span {
3030
}
3131

3232
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
33-
impl MultiSpan for Vec<Span> {
33+
impl MultiSpan for Vec<Span, Global, DEFAULT_COOP_PREFERRED> {
3434
fn into_spans(self) -> Vec<Span> {
3535
self
3636
}

0 commit comments

Comments
 (0)