diff --git a/core/engine/src/error.rs b/core/engine/src/error.rs
index fa5e2969d3..d56b20e68c 100644
--- a/core/engine/src/error.rs
+++ b/core/engine/src/error.rs
@@ -46,16 +46,12 @@ use thiserror::Error;
/// let kind = &native_error.as_native().unwrap().kind;
/// assert!(matches!(kind, JsNativeErrorKind::Type));
/// ```
-#[derive(Debug, Clone, Finalize, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Trace, Finalize)]
+#[boa_gc(unsafe_no_drop)]
pub struct JsError {
inner: Repr,
}
-// SAFETY: just mirroring the default derive to allow destructuring.
-unsafe impl Trace for JsError {
- custom_trace!(this, mark, mark(&this.inner));
-}
-
/// Internal representation of a [`JsError`].
///
/// `JsError` is represented by an opaque enum because it restricts
@@ -66,24 +62,13 @@ unsafe impl Trace for JsError {
/// This should never be used outside of this module. If that's not the case,
/// you should add methods to either `JsError` or `JsNativeError` to
/// represent that special use case.
-#[derive(Debug, Clone, Finalize, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Trace, Finalize)]
+#[boa_gc(unsafe_no_drop)]
enum Repr {
Native(JsNativeError),
Opaque(JsValue),
}
-// SAFETY: just mirroring the default derive to allow destructuring.
-unsafe impl Trace for Repr {
- custom_trace!(
- this,
- mark,
- match &this {
- Self::Native(err) => mark(err),
- Self::Opaque(val) => mark(val),
- }
- );
-}
-
/// The error type returned by the [`JsError::try_native`] method.
#[derive(Debug, Clone, Error)]
pub enum TryNativeError {
diff --git a/core/engine/src/module/mod.rs b/core/engine/src/module/mod.rs
index bcf07e99f2..83f3e3b479 100644
--- a/core/engine/src/module/mod.rs
+++ b/core/engine/src/module/mod.rs
@@ -63,7 +63,6 @@ impl std::fmt::Debug for Module {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Module")
.field("realm", &self.inner.realm.addr())
- .field("environment", &self.inner.environment)
.field("namespace", &self.inner.namespace)
.field("kind", &self.inner.kind)
.finish()
@@ -73,7 +72,6 @@ impl std::fmt::Debug for Module {
#[derive(Trace, Finalize)]
struct ModuleRepr {
realm: Realm,
- environment: GcRefCell