From 97beb5028f7b3b550c1b25345347b0b29fb5d3c7 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sun, 18 Dec 2022 19:37:37 -0800 Subject: [PATCH] Remove Trace implementation for Rc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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' Fixes #134. Signed-off-by: Anders Kaseorg --- gc/src/trace.rs | 16 ---------------- gc/tests/trace_impl.rs | 5 ----- 2 files changed, 21 deletions(-) diff --git a/gc/src/trace.rs b/gc/src/trace.rs index c881bfc..816c3fe 100644 --- a/gc/src/trace.rs +++ b/gc/src/trace.rs @@ -237,22 +237,6 @@ type_arg_tuple_based_finalize_trace_impls![ (A, B, C, D, E, F, G, H, I, J, K, L); ]; -impl Finalize for Rc {} -unsafe impl Trace for Rc { - custom_trace!(this, { - mark(&**this); - }); -} - -impl Finalize for Rc<[T]> {} -unsafe impl Trace for Rc<[T]> { - custom_trace!(this, { - for e in this.iter() { - mark(e); - } - }); -} - impl Finalize for Box {} unsafe impl Trace for Box { custom_trace!(this, { diff --git a/gc/tests/trace_impl.rs b/gc/tests/trace_impl.rs index c59783f..9840133 100644 --- a/gc/tests/trace_impl.rs +++ b/gc/tests/trace_impl.rs @@ -46,11 +46,6 @@ struct InnerRcStr { inner: Rc, } -#[derive(Trace, Clone, Finalize)] -struct InnerRcStruct { - inner: Rc, -} - #[derive(Trace, Finalize)] struct Baz { a: Bar,