|
2 | 2 | //!
|
3 | 3 | //! This includes references, tuples, primitives, arrays, and everything else in `libcore`.
|
4 | 4 | //!
|
5 |
| -//! `RefCell` and `Cell` are intentionally ignored and do not have implementations. |
6 |
| -//! Some collectors may need write barriers to protect their internals. |
| 5 | +//! `RefCell` and `Cell` require `T: NullTrace` and do not have implementations for other types. |
| 6 | +//! This is because some collectors may need write barriers to protect their internals. |
7 | 7 | use core::num::Wrapping;
|
8 | 8 | use core::marker::PhantomData;
|
| 9 | +use core::cell::{RefCell, Cell}; |
9 | 10 |
|
10 | 11 | use crate::prelude::*;
|
11 | 12 | use crate::GcDirectBarrier;
|
@@ -200,6 +201,40 @@ unsafe_gc_impl! {
|
200 | 201 | }
|
201 | 202 |
|
202 | 203 |
|
| 204 | +unsafe_gc_impl!( |
| 205 | + target => Cell<T>, |
| 206 | + params => [T: NullTrace], |
| 207 | + bounds => { |
| 208 | + GcRebrand => { where T: NullTrace, T: 'new_gc }, |
| 209 | + GcErase => { where T: NullTrace, T: 'min } |
| 210 | + }, |
| 211 | + branded_type => Self, |
| 212 | + erased_type => Self, |
| 213 | + null_trace => always, |
| 214 | + NEEDS_TRACE => false, |
| 215 | + NEEDS_DROP => T::NEEDS_DROP, |
| 216 | + visit => |self, visitor| { |
| 217 | + Ok(()) /* nop */ |
| 218 | + } |
| 219 | +); |
| 220 | +unsafe_gc_impl!( |
| 221 | + target => RefCell<T>, |
| 222 | + params => [T: NullTrace], |
| 223 | + bounds => { |
| 224 | + GcRebrand => { where T: NullTrace, T: 'new_gc }, |
| 225 | + GcErase => { where T: NullTrace, T: 'min } |
| 226 | + }, |
| 227 | + branded_type => Self, |
| 228 | + erased_type => Self, |
| 229 | + null_trace => always, |
| 230 | + NEEDS_TRACE => false, |
| 231 | + NEEDS_DROP => T::NEEDS_DROP, |
| 232 | + visit => |self, visitor| { |
| 233 | + Ok(()) /* nop */ |
| 234 | + } |
| 235 | +); |
| 236 | + |
| 237 | + |
203 | 238 | /*
|
204 | 239 | * Implements tracing for mutable references.
|
205 | 240 | *
|
|
0 commit comments