We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fffcbdc commit 45f42b7Copy full SHA for 45f42b7
library/alloc/src/gc.rs
@@ -222,7 +222,17 @@ struct GcBox<T: ?Sized>(ManuallyDrop<T>);
222
impl<T> GcBox<T> {
223
fn new(value: T) -> *mut GcBox<T> {
224
let layout = Layout::new::<T>();
225
+
226
+ #[cfg(bootstrap)]
227
let ptr = ALLOCATOR.allocate(layout).unwrap().as_ptr() as *mut GcBox<T>;
228
229
+ #[cfg(not(bootstrap))]
230
+ let ptr = if core::gc::needs_tracing::<T>() {
231
+ ALLOCATOR.allocate(layout).unwrap().as_ptr()
232
+ } else {
233
+ ALLOCATOR.alloc_untraceable(layout).unwrap().as_ptr()
234
+ } as *mut GcBox<T>;
235
236
let gcbox = GcBox(ManuallyDrop::new(value));
237
238
unsafe {
0 commit comments