File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use vec;
26
26
/// An atomically reference counted pointer.
27
27
///
28
28
/// Enforces no shared-memory safety.
29
+ #[ unsafe_no_drop_flag]
29
30
pub struct UnsafeArc < T > {
30
31
data : * mut ArcData < T > ,
31
32
}
@@ -221,8 +222,9 @@ impl<T: Send> Clone for UnsafeArc<T> {
221
222
impl < T > Drop for UnsafeArc < T > {
222
223
fn drop ( & self ) {
223
224
unsafe {
225
+ // Happens when destructing an unwrapper's handle and from `#[unsafe_no_drop_flag]`
224
226
if self . data . is_null ( ) {
225
- return ; // Happens when destructing an unwrapper's handle.
227
+ return
226
228
}
227
229
let mut data: ~ArcData < T > = cast:: transmute ( self . data ) ;
228
230
// Must be acquire+release, not just release, to make sure this
@@ -440,6 +442,12 @@ mod tests {
440
442
use super :: { Exclusive , UnsafeArc , atomically} ;
441
443
use task;
442
444
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
+ }
443
451
444
452
#[ test]
445
453
fn test_atomically ( ) {
You can’t perform that action at this time.
0 commit comments