From d42693a52b9486a9ba7ad059c49cae21ab593c00 Mon Sep 17 00:00:00 2001 From: Piotr Czarnecki Date: Thu, 13 Aug 2015 18:48:34 +0200 Subject: [PATCH] TypedArena implements Send --- src/libarena/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index bb6521254a3b..851a864a73bd 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -45,7 +45,7 @@ extern crate alloc; use std::cell::{Cell, RefCell}; use std::cmp; use std::intrinsics; -use std::marker; +use std::marker::{PhantomData, Send}; use std::mem; use std::ptr; use std::raw; @@ -103,7 +103,7 @@ pub struct Arena<'longer_than_self> { head: RefCell, copy_head: RefCell, chunks: RefCell>, - _marker: marker::PhantomData<*mut &'longer_than_self ()>, + _marker: PhantomData<*mut &'longer_than_self ()>, } impl<'a> Arena<'a> { @@ -118,7 +118,7 @@ impl<'a> Arena<'a> { head: RefCell::new(chunk(initial_size, false)), copy_head: RefCell::new(chunk(initial_size, true)), chunks: RefCell::new(Vec::new()), - _marker: marker::PhantomData, + _marker: PhantomData, } } } @@ -382,7 +382,7 @@ pub struct TypedArena { /// Marker indicating that dropping the arena causes its owned /// instances of `T` to be dropped. - _own: marker::PhantomData, + _own: PhantomData, } struct TypedArenaChunk { @@ -452,7 +452,7 @@ impl TypedArena { ptr: Cell::new(chunk.start()), end: Cell::new(chunk.end()), chunks: RefCell::new(vec![chunk]), - _own: marker::PhantomData, + _own: PhantomData, } } } @@ -531,6 +531,8 @@ impl Drop for TypedArena { } } +unsafe impl Send for TypedArena {} + #[cfg(test)] mod tests { extern crate test;