Skip to content

Commit d42693a

Browse files
committed
TypedArena implements Send
1 parent 803e9ae commit d42693a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/libarena/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern crate alloc;
4545
use std::cell::{Cell, RefCell};
4646
use std::cmp;
4747
use std::intrinsics;
48-
use std::marker;
48+
use std::marker::{PhantomData, Send};
4949
use std::mem;
5050
use std::ptr;
5151
use std::raw;
@@ -103,7 +103,7 @@ pub struct Arena<'longer_than_self> {
103103
head: RefCell<Chunk>,
104104
copy_head: RefCell<Chunk>,
105105
chunks: RefCell<Vec<Chunk>>,
106-
_marker: marker::PhantomData<*mut &'longer_than_self ()>,
106+
_marker: PhantomData<*mut &'longer_than_self ()>,
107107
}
108108

109109
impl<'a> Arena<'a> {
@@ -118,7 +118,7 @@ impl<'a> Arena<'a> {
118118
head: RefCell::new(chunk(initial_size, false)),
119119
copy_head: RefCell::new(chunk(initial_size, true)),
120120
chunks: RefCell::new(Vec::new()),
121-
_marker: marker::PhantomData,
121+
_marker: PhantomData,
122122
}
123123
}
124124
}
@@ -382,7 +382,7 @@ pub struct TypedArena<T> {
382382

383383
/// Marker indicating that dropping the arena causes its owned
384384
/// instances of `T` to be dropped.
385-
_own: marker::PhantomData<T>,
385+
_own: PhantomData<T>,
386386
}
387387

388388
struct TypedArenaChunk<T> {
@@ -452,7 +452,7 @@ impl<T> TypedArena<T> {
452452
ptr: Cell::new(chunk.start()),
453453
end: Cell::new(chunk.end()),
454454
chunks: RefCell::new(vec![chunk]),
455-
_own: marker::PhantomData,
455+
_own: PhantomData,
456456
}
457457
}
458458
}
@@ -531,6 +531,8 @@ impl<T> Drop for TypedArena<T> {
531531
}
532532
}
533533

534+
unsafe impl<T: Send> Send for TypedArena<T> {}
535+
534536
#[cfg(test)]
535537
mod tests {
536538
extern crate test;

0 commit comments

Comments
 (0)