Auto merge of #15562 - emilio:rule-mem-order, r=bholley

style: Tweak rule tree memory ordering.

I've commented on the ones that I think are the most tricky. Note that this code
is stress-tested in the style tests (tests/unit/style/rule_tree/bench.rs).

<!-- 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/15562)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-03 15:15:49 -05:00 committed by GitHub
commit dc8ed0d740
2 changed files with 80 additions and 41 deletions

View file

@ -32,7 +32,12 @@ impl<'a> AutoGCRuleTree<'a> {
impl<'a> Drop for AutoGCRuleTree<'a> {
fn drop(&mut self) {
unsafe { self.0.gc() }
unsafe {
self.0.gc();
assert!(::std::thread::panicking() ||
!self.0.root().has_children_for_testing(),
"No rule nodes other than the root shall remain!");
}
}
}