Skip to content

Commit ebb2264

Browse files
CoAlloc: Renamed feature global_co_alloc_def to global_co_alloc_default. tidy
1 parent 43855d4 commit ebb2264

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

library/alloc/src/ffi/c_str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#[cfg(test)]
22
mod tests;
33

4+
use crate::alloc::Global;
45
use crate::borrow::{Cow, ToOwned};
56
use crate::boxed::Box;
67
use crate::rc::Rc;
78
use crate::slice::hack::into_vec;
89
use crate::string::String;
910
use crate::vec::Vec;
11+
use crate::DEFAULT_COOP_PREFERRED;
1012
use core::borrow::Borrow;
1113
use core::ffi::{c_char, CStr};
1214
use core::fmt;
@@ -17,8 +19,6 @@ use core::ptr;
1719
use core::slice;
1820
use core::slice::memchr;
1921
use core::str::{self, Utf8Error};
20-
use crate::alloc::Global;
21-
use crate::DEFAULT_COOP_PREFERRED;
2222

2323
#[cfg(target_has_atomic = "ptr")]
2424
use crate::sync::Arc;
@@ -726,7 +726,7 @@ impl fmt::Debug for CString {
726726

727727
#[stable(feature = "cstring_into", since = "1.7.0")]
728728
#[allow(unused_braces)]
729-
impl From<CString> for Vec<u8, Global, {DEFAULT_COOP_PREFERRED!()}> {
729+
impl From<CString> for Vec<u8, Global, { DEFAULT_COOP_PREFERRED!() }> {
730730
/// Converts a [`CString`] into a <code>[Vec]<[u8]></code>.
731731
///
732732
/// The conversion consumes the [`CString`], and removes the terminating NUL byte.

library/alloc/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
#![feature(global_co_alloc_short_term_pref)]
186186
#![feature(hashmap_internals)]
187187
#![feature(lang_items)]
188-
#![feature(global_co_alloc_def)]
188+
#![feature(global_co_alloc_default)]
189189
// When we used min_specialization instead of specialization, library/alloc/src/vec/mod.rs was failing with:
190190
// - cannot specialize on predicate `the constant `core::alloc::co_alloc_metadata_num_slots::<A>()` can be evaluated`
191191
// - cannot specialize on predicate `[(); _] well-formed`

library/alloc/src/vec/mod.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ use self::spec_extend::SpecExtend;
150150
mod spec_extend;
151151

152152
/// Default `Vec`, `DefVec`, `DecVeque`, `DefDecVeq` "cooperation" (`COOP_PREFERRED`) generic parameter.
153-
/// NOT for public use. It's exported only so that library/proc_macro (and other internals) can use this. TODO FIXME.
154-
#[unstable(feature = "global_co_alloc_def", issue = "none")]
153+
/// NOT for public use. It's exported only so that library/proc_macro (and other internals) can use this. FIXME.
154+
#[unstable(feature = "global_co_alloc_default", issue = "none")]
155155
// pub const DEFAULT_COOP_PREFERRED: bool = true;
156156
#[macro_export]
157157
macro_rules! DEFAULT_COOP_PREFERRED {
@@ -445,10 +445,10 @@ pub type DefVec<T, A = Global> = Vec<T, A, { DEFAULT_COOP_PREFERRED!() }>;
445445
pub type WeVec<T, const WEIGHT: u8> = Vec<T, Global, { WEIGHT > 127 }>;
446446

447447
impl<T> Vec<T> {
448-
/*impl<T, const COOP_PREFERRED: bool> Vec<T, Global, COOP_PREFERRED>
449-
where
450-
[(); core::alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED)]:,
451-
{*/
448+
/*impl<T, const COOP_PREFERRED: bool> Vec<T, Global, COOP_PREFERRED>
449+
where
450+
[(); core::alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED)]:,
451+
{*/
452452
/// Constructs a new, empty `Vec<T>`.
453453
///
454454
/// The vector will not allocate until elements are pushed onto it.
@@ -525,7 +525,6 @@ where
525525
pub fn with_capacity(capacity: usize) -> Self {
526526
Self::with_capacity_in(capacity, Global)
527527
}
528-
529528
}
530529

531530
////////////////////////////////////////////////////////////////////////////////
@@ -546,7 +545,7 @@ where
546545
Vec { buf: RawVec::NEW, len: 0 }
547546
}
548547

549-
// TODO @FIXME document co-allocation
548+
// @FIXME document co-allocation
550549
/// Constructs a new, empty `Vec<T>` with at least the specified capacity.
551550
///
552551
/// The vector will be able to hold at least `capacity` elements without

library/proc_macro/src/bridge/rpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use std::io::Write;
66
use std::num::NonZeroU32;
77
use std::str;
88
//use std::alloc::Global;
9-
use alloc::DEFAULT_COOP_PREFERRED;
109
use alloc::alloc::Global;
10+
use alloc::DEFAULT_COOP_PREFERRED;
1111

1212
pub(super) type Writer = super::buffer::Buffer;
1313

library/proc_macro/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#![feature(min_specialization)]
3434
#![feature(strict_provenance)]
3535
#![recursion_limit = "256"]
36-
#![feature(global_co_alloc_def)]
36+
#![feature(global_co_alloc_default)]
3737

3838
#[unstable(feature = "proc_macro_internals", issue = "27812")]
3939
#[doc(hidden)]

0 commit comments

Comments
 (0)