Skip to content

Commit

Permalink
Remove Trace implementation for Rc
Browse files Browse the repository at this point in the history
I’m not sure if these impls would work with a better tracing
algorithm, but they do not work correctly with this one.

    let r = Rc::new(Gc::new(()));
    Gc::new((Rc::clone(&r), r));
    // → thread 'main' panicked at 'Can't double-unroot a Gc<T>'

Fixes Manishearth#134.

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Dec 19, 2022
1 parent 6c5f754 commit 97beb50
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
16 changes: 0 additions & 16 deletions gc/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,6 @@ type_arg_tuple_based_finalize_trace_impls![
(A, B, C, D, E, F, G, H, I, J, K, L);
];

impl<T: Trace + ?Sized> Finalize for Rc<T> {}
unsafe impl<T: Trace + ?Sized> Trace for Rc<T> {
custom_trace!(this, {
mark(&**this);
});
}

impl<T: Trace> Finalize for Rc<[T]> {}
unsafe impl<T: Trace> Trace for Rc<[T]> {
custom_trace!(this, {
for e in this.iter() {
mark(e);
}
});
}

impl<T: Trace + ?Sized> Finalize for Box<T> {}
unsafe impl<T: Trace + ?Sized> Trace for Box<T> {
custom_trace!(this, {
Expand Down
5 changes: 0 additions & 5 deletions gc/tests/trace_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ struct InnerRcStr {
inner: Rc<str>,
}

#[derive(Trace, Clone, Finalize)]
struct InnerRcStruct {
inner: Rc<Bar>,
}

#[derive(Trace, Finalize)]
struct Baz {
a: Bar,
Expand Down

0 comments on commit 97beb50

Please sign in to comment.