File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use vec;
2626/// An atomically reference counted pointer.
2727///
2828/// Enforces no shared-memory safety.
29+ #[ unsafe_no_drop_flag]
2930pub struct UnsafeArc < T > {
3031 data : * mut ArcData < T > ,
3132}
@@ -221,8 +222,9 @@ impl<T: Send> Clone for UnsafeArc<T> {
221222impl < T > Drop for UnsafeArc < T > {
222223 fn drop ( & self ) {
223224 unsafe {
225+ // Happens when destructing an unwrapper's handle and from `#[unsafe_no_drop_flag]`
224226 if self . data . is_null ( ) {
225- return ; // Happens when destructing an unwrapper's handle.
227+ return
226228 }
227229 let mut data: ~ArcData < T > = cast:: transmute ( self . data ) ;
228230 // Must be acquire+release, not just release, to make sure this
@@ -440,6 +442,12 @@ mod tests {
440442 use super :: { Exclusive , UnsafeArc , atomically} ;
441443 use task;
442444 use util;
445+ use sys:: size_of;
446+
447+ #[ test]
448+ fn test_size ( ) {
449+ assert_eq ! ( size_of:: <UnsafeArc <[ int, ..10 ] >>( ) , size_of:: <* [ int, ..10 ] >( ) ) ;
450+ }
443451
444452 #[ test]
445453 fn test_atomically ( ) {
You can’t perform that action at this time.
0 commit comments