Skip to content

Commit 43855d4

Browse files
CoAlloc: library/proc_macro (+related library/alloc): Experimenting with importing DEFAULT_COOP_PREFERRED
1 parent 20f0301 commit 43855d4

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

library/alloc/src/vec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ 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.
153154
#[unstable(feature = "global_co_alloc_def", issue = "none")]
154155
// pub const DEFAULT_COOP_PREFERRED: bool = true;
155156
#[macro_export]

library/proc_macro/src/bridge/rpc.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use std::char;
55
use std::io::Write;
66
use std::num::NonZeroU32;
77
use std::str;
8+
//use std::alloc::Global;
9+
use alloc::DEFAULT_COOP_PREFERRED;
10+
use alloc::alloc::Global;
811

912
pub(super) type Writer = super::buffer::Buffer;
1013

@@ -225,7 +228,7 @@ impl<S> DecodeMut<'_, '_, S> for String {
225228
}
226229
}
227230

228-
impl<S, T: Encode<S>> Encode<S> for Vec<T, Global, DEFAULT_COOP_PREFERRED> {
231+
impl<S, T: Encode<S>> Encode<S> for Vec<T, Global, DEFAULT_COOP_PREFERRED!()> {
229232
fn encode(self, w: &mut Writer, s: &mut S) {
230233
self.len().encode(w, s);
231234
for x in self {

library/proc_macro/src/lib.rs

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

3738
#[unstable(feature = "proc_macro_internals", issue = "27812")]
3839
#[doc(hidden)]

0 commit comments

Comments
 (0)