We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fac5348 commit b00d983Copy full SHA for b00d983
homework/src/arc.rs
@@ -444,8 +444,13 @@ impl<T> Drop for Arc<T> {
444
/// drop(foo2); // Prints "dropped!"
445
/// ```
446
fn drop(&mut self) {
447
- self.inner().count.fetch_sub(1, Ordering::AcqRel);
448
- if self.inner().count.load(Ordering::Acquire) == 0 {
+ // TODO: reason not known yet
+ // The following code does not work in check-loom mode.
449
+ // self.inner().count.fetch_sub(1, Ordering::AcqRel);
450
+ // if self.inner().count.load(Ordering::Acquire) == 0 {
451
+
452
+ // pass the test in check-loom mode
453
+ if self.inner().count.fetch_sub(1, Ordering::AcqRel) == 1 {
454
unsafe {
455
// drop the inner value
456
drop(Box::from_raw(self.ptr.as_ptr()));
0 commit comments