Skip to content

Commit 81d49a7

Browse files
CoAlloc: Vec: Tidy. ICE
1 parent c84a040 commit 81d49a7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

library/alloc/src/vec/mod.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ pub type WeVec<T, const weight: u8> = Vec<T, Global, { weight > 127 }>;
439439
// Inherent methods
440440
////////////////////////////////////////////////////////////////////////////////
441441

442-
impl<T> Vec<T> {
442+
impl<T, const COOP_PREFERRED: bool> Vec<T, Global, COOP_PREFERRED>
443+
where
444+
[(); crate::co_alloc_metadata_num_slots_with_preference_global(COOP_PREFERRED)]:,
445+
{
443446
/// Constructs a new, empty `Vec<T>`.
444447
///
445448
/// The vector will not allocate until elements are pushed onto it.
@@ -3193,11 +3196,14 @@ where
31933196

31943197
#[stable(feature = "rust1", since = "1.0.0")]
31953198
#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
3196-
impl<T> const Default for Vec<T> {
3199+
impl<T, const COOP_PREFERRED: bool> const Default for Vec<T, Global, COOP_PREFERRED>
3200+
where
3201+
[(); crate::co_alloc_metadata_num_slots_with_preference_global(COOP_PREFERRED)]:,
3202+
{
31973203
/// Creates an empty `Vec<T>`.
31983204
///
31993205
/// The vector will not allocate until elements are pushed onto it.
3200-
fn default() -> Vec<T> {
3206+
fn default() -> Vec<T, Global, COOP_PREFERRED> {
32013207
Vec::new()
32023208
}
32033209
}

0 commit comments

Comments
 (0)