Mark JSTraceable and its method as unsafe

This commit is contained in:
Anthony Ramine 2016-12-01 02:50:06 +01:00
parent 73b6e705b4
commit 620a67ff14
16 changed files with 191 additions and 185 deletions

View file

@ -122,8 +122,8 @@ which has an area, and the trait provides a way to get that object's area.
Now let's look at the `JSTraceable` trait, which we use for tracing:
```rust
pub trait JSTraceable {
fn trace(&self, trc: *mut JSTracer);
pub unsafe trait JSTraceable {
unsafe fn trace(&self, trc: *mut JSTracer);
}
```
@ -182,7 +182,7 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref
}
impl<T: Reflectable> JSTraceable for JS<T> {
fn trace(&self, trc: *mut JSTracer) {
unsafe fn trace(&self, trc: *mut JSTracer) {
trace_reflector(trc, "", unsafe { (**self.ptr).reflector() });
}
}