Skip to content

Commit 30f2fdb

Browse files
CoAlloc: Vec: Working around ICE rust-lang/rust issue rust-lang#106473 ICE. WIP
1 parent e1d529e commit 30f2fdb

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
@@ -2845,7 +2845,7 @@ where
28452845

28462846
#[cfg(not(no_global_oom_handling))]
28472847
#[stable(feature = "rust1", since = "1.0.0")]
2848-
impl<T> FromIterator<T> for Vec<T> {
2848+
impl<T> FromIterator<T> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
28492849
#[inline]
28502850
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Vec<T> {
28512851
<Self as SpecFromIter<T, I::IntoIter>>::from_iter(iter.into_iter())
@@ -3263,7 +3263,7 @@ where
32633263

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

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

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

33283328
#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
3329-
impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
3329+
impl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global, DEFAULT_COOP_PREFERRED>
33303330
where
33313331
[T]: ToOwned<Owned = Vec<T>>,
33323332
{
@@ -3403,7 +3403,7 @@ where
34033403

34043404
#[cfg(not(no_global_oom_handling))]
34053405
#[stable(feature = "rust1", since = "1.0.0")]
3406-
impl From<&str> for Vec<u8> {
3406+
impl From<&str> for Vec<u8, Global, DEFAULT_COOP_PREFERRED> {
34073407
/// Allocate a `Vec<u8>` and fill it with a UTF-8 string.
34083408
///
34093409
/// # 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
@@ -224,7 +224,7 @@ impl<S> DecodeMut<'_, '_, S> for String {
224224
}
225225
}
226226

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

236-
impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec<T> {
236+
impl<'a, S, T: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
237237
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
238238
let len = usize::decode(r, s);
239239
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)