Skip to content

Commit

Permalink
Add tracing for TypedArray
Browse files Browse the repository at this point in the history
  • Loading branch information
sagudev committed Jun 22, 2023
1 parent 3532318 commit 2840abc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rust-mozjs/src/gc/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use std::sync::atomic::{
};
use std::sync::Arc;

use crate::typedarray::{TypedArray, TypedArrayElement};

/// Types that can be traced.
///
/// This trait is unsafe; if it is implemented incorrectly, the GC may end up collecting objects
Expand Down Expand Up @@ -216,6 +218,12 @@ unsafe impl<T: Traceable> Traceable for BTreeSet<T> {
}
}

unsafe impl<T: TypedArrayElement> Traceable for TypedArray<T, Box<Heap<*mut JSObject>>> {
unsafe fn trace(&self, trc: *mut JSTracer) {
self.underlying_object().trace(trc);
}
}

macro_rules! impl_traceable_tuple {
() => {
unsafe impl Traceable for () {
Expand Down

0 comments on commit 2840abc

Please sign in to comment.