File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,11 @@ impl<T> Arc<T> {
497
497
let inner = init_ptr. as_ptr ( ) ;
498
498
ptr:: write ( ptr:: addr_of_mut!( ( * inner) . data) , data) ;
499
499
500
+ debug_assert ! (
501
+ ( * inner) . strong. load( Relaxed ) & STRONG_DROPPED != 0 ,
502
+ "No prior strong references should exist"
503
+ ) ;
504
+
500
505
// The above write to the data field must be visible to any threads which
501
506
// observe a non-zero strong count. Therefore we need at least "Release" ordering
502
507
// in order to synchronize with the `compare_exchange_weak` in `Weak::upgrade`.
@@ -509,11 +514,6 @@ impl<T> Arc<T> {
509
514
//
510
515
// These side effects do not impact us in any way, and no other side effects are
511
516
// possible with safe code alone.
512
- debug_assert_eq ! (
513
- ( * inner) . strong. load( Relaxed ) ,
514
- 1 ,
515
- "No prior strong references should exist"
516
- ) ;
517
517
( * inner) . strong . store ( ONE_STRONG_WITH_WEAK , Release ) ;
518
518
519
519
Arc :: from_inner ( init_ptr)
You can’t perform that action at this time.
0 commit comments