diff --git a/src/lib/vm/objects/block.rs b/src/lib/vm/objects/block.rs index bb64dc59..61690d4d 100644 --- a/src/lib/vm/objects/block.rs +++ b/src/lib/vm/objects/block.rs @@ -74,14 +74,6 @@ pub struct Block { pub method_stack_base: usize, } -// The following impls are needed to allow the GC to finalise `Block`. By -// default, `Block` is not `FinalizerSafe` because it has fields to other `Gc`s. -// These fields would be unsound to access inside a `drop` method, so this -// explicit impl is needed to tell the compiler we are not doing that. The only -// time a `Block` is shared between threads is inside a finaliser, which is -// Sync-safe because we guarantee it will not be accessed at the same time as -// the main-thread. -unsafe impl FinalizerSafe for Block {} unsafe impl Sync for Block {} impl Obj for Block { diff --git a/src/lib/vm/objects/class.rs b/src/lib/vm/objects/class.rs index f44e74f8..4afcbb95 100644 --- a/src/lib/vm/objects/class.rs +++ b/src/lib/vm/objects/class.rs @@ -36,11 +36,6 @@ pub struct Class { inst_vars: UnsafeCell>, } -// This is safe because there is no non-GC'd shared ownership inside `Class`. -// This means that even though a finalizer will call its drop methods in another -// thread, it is guaranteed that the finalizer thread will be the only thread -// accessing its data. -unsafe impl FinalizerSafe for Class {} unsafe impl Sync for Class {} impl Obj for Class { diff --git a/src/lib/vm/objects/method.rs b/src/lib/vm/objects/method.rs index abdf4ebe..4c4c3f3f 100644 --- a/src/lib/vm/objects/method.rs +++ b/src/lib/vm/objects/method.rs @@ -17,11 +17,6 @@ pub struct Method { pub func: Function, } -// By default, `Method` is not `FinalizerSafe` because it contains a `Cell` -// field. Cell is `!Sync` so it would be unsound to access inside a `drop` -// method. This explicit impl is needed to tell the compiler we are not doing -// that. -unsafe impl FinalizerSafe for Method {} unsafe impl Sync for Method {} impl Obj for Method { diff --git a/src/lib/vm/objects/mod.rs b/src/lib/vm/objects/mod.rs index bd0895f8..b4d5d16e 100644 --- a/src/lib/vm/objects/mod.rs +++ b/src/lib/vm/objects/mod.rs @@ -80,7 +80,7 @@ impl ObjType { /// The main SOM Object trait. Notice that code should almost never call these functions directly: /// you should instead call the equivalent function in the `Val` struct. #[narrowable_alloy(ThinObj)] -pub trait Obj: std::fmt::Debug + Send + Sync + FinalizerSafe { +pub trait Obj: std::fmt::Debug + Send + Sync { /// What `ObjType` does this `Val` represent? fn dyn_objtype(self: Gc) -> ObjType; diff --git a/src/lib/vm/objects/string_.rs b/src/lib/vm/objects/string_.rs index a2d58f24..e17f627e 100644 --- a/src/lib/vm/objects/string_.rs +++ b/src/lib/vm/objects/string_.rs @@ -28,11 +28,6 @@ pub struct String_ { s: String, } -// This is safe because there is no non-GC'd shared ownership inside `String_`. -// This means that even though a finalizer will call its drop methods in another -// thread, it is guaranteed that the finalizer thread will be the only thread -// accessing its data. -unsafe impl FinalizerSafe for String_ {} unsafe impl Sync for String_ {} impl Obj for String_ {