Auto merge of #17672 - sadmansk:heap_in_box, r=jdm

Use boxed slice instead of vec for FuntionTimerCallback

<!-- Please describe your changes on the following line: -->
Added `fn trace()` implementation for `Box<[T]>` type, and change FunctionTimerCallback to store boxed slices for heap values instead of Vector.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #17611

<!-- Either: -->
- [x] These changes do not require tests

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17672)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-07-11 18:55:18 -07:00 committed by GitHub
commit 749891e48e
2 changed files with 10 additions and 2 deletions

View file

@ -177,6 +177,14 @@ unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> {
}
}
unsafe impl<T: JSTraceable> JSTraceable for [T] {
unsafe fn trace(&self, trc: *mut JSTracer) {
for e in self.iter() {
e.trace(trc);
}
}
}
unsafe impl<T: JSTraceable + Copy> JSTraceable for Cell<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
self.get().trace(trc)