Skip to content

Commit b7836cd

Browse files
Tidy
1 parent cc1f135 commit b7836cd

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.
@@ -3211,11 +3214,14 @@ where
32113214

32123215
#[stable(feature = "rust1", since = "1.0.0")]
32133216
#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
3214-
impl<T> const Default for Vec<T> {
3217+
impl<T, const COOP_PREFERRED: bool> const Default for Vec<T, Global, COOP_PREFERRED>
3218+
where
3219+
[(); crate::co_alloc_metadata_num_slots_with_preference_global(COOP_PREFERRED)]:,
3220+
{
32153221
/// Creates an empty `Vec<T>`.
32163222
///
32173223
/// The vector will not allocate until elements are pushed onto it.
3218-
fn default() -> Vec<T> {
3224+
fn default() -> Vec<T, Global, COOP_PREFERRED> {
32193225
Vec::new()
32203226
}
32213227
}

0 commit comments

Comments
 (0)