Skip to content

Commit 0dd553e

Browse files
CoAlloc: FIXME: back to min_specialization
1 parent 79276fc commit 0dd553e

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

library/alloc/src/collections/vec_deque/spec_from_iter.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,46 @@ where
5656
}
5757
}
5858

59+
// Until we can use feature `specialization`:
60+
// TODO macro
61+
impl<T>
62+
SpecFromIterCo<T, crate::vec::IntoIter<T, Global, 0>>
63+
for VecDeque<T, Global, 0>
64+
{
65+
#[inline]
66+
fn spec_from_iter_co(iterator: crate::vec::IntoIter<T, Global, 0>) -> Self {
67+
iterator.into_vecdeque()
68+
}
69+
}
70+
impl<T>
71+
SpecFromIterCo<T, crate::vec::IntoIter<T, Global, 1>>
72+
for VecDeque<T, Global, 1>
73+
{
74+
#[inline]
75+
fn spec_from_iter_co(iterator: crate::vec::IntoIter<T, Global, 1>) -> Self {
76+
iterator.into_vecdeque()
77+
}
78+
}
79+
80+
impl<T> SpecFromIterCo<T, IntoIter<T, Global, 0>>
81+
for VecDeque<T, Global, 0>
82+
{
83+
#[inline]
84+
fn spec_from_iter_co(iterator: IntoIter<T, Global, 0>) -> Self {
85+
iterator.into_vecdeque()
86+
}
87+
}
88+
impl<T> SpecFromIterCo<T, IntoIter<T, Global, 1>>
89+
for VecDeque<T, Global, 1>
90+
{
91+
#[inline]
92+
fn spec_from_iter_co(iterator: IntoIter<T, Global, 1>) -> Self {
93+
iterator.into_vecdeque()
94+
}
95+
}
96+
97+
// WITH unstable feature `specialization`:
98+
/*
5999
#[allow(unused_braces)]
60100
impl<T, const CO_ALLOC_PREF: CoAllocPref>
61101
SpecFromIterCo<T, crate::vec::IntoIter<T, Global, CO_ALLOC_PREF>>
@@ -80,3 +120,4 @@ where
80120
iterator.into_vecdeque()
81121
}
82122
}
123+
*/

library/alloc/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,8 @@
184184
#![feature(hashmap_internals)]
185185
#![feature(lang_items)]
186186
#![feature(global_co_alloc_default)]
187-
// When we used min_specialization instead of specialization, library/alloc/src/vec/mod.rs was failing with:
188-
// - cannot specialize on predicate `the constant `core::alloc::co_alloc_metadata_num_slots::<A>()` can be evaluated`
189-
// - cannot specialize on predicate `[(); _] well-formed`
190-
// - cannot specialize on predicate `the constant `core::alloc::co_alloc_metadata_num_slots::<A>()` can be evaluated`
191-
//#![feature(min_specialization)]
187+
#![feature(min_specialization)]
192188
#![feature(associated_type_defaults)]
193-
#![feature(specialization)]
194189
#![feature(negative_impls)]
195190
#![feature(never_type)]
196191
#![feature(rustc_allow_const_fn_unstable)]

0 commit comments

Comments
 (0)