From bc4e2942bff4c2998b5c2a36144b168b02e884b3 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 16 Apr 2020 16:24:19 +0200 Subject: [PATCH] Make StrongRuleNode::downgrade be unsafe --- components/style/rule_tree/core.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/style/rule_tree/core.rs b/components/style/rule_tree/core.rs index d1aaa0d26a3..0e1dcc6c433 100644 --- a/components/style/rule_tree/core.rs +++ b/components/style/rule_tree/core.rs @@ -367,8 +367,8 @@ impl StrongRuleNode { StrongRuleNode { p } } - fn downgrade(&self) -> WeakRuleNode { - unsafe { WeakRuleNode::from_ptr(self.p) } + unsafe fn downgrade(&self) -> WeakRuleNode { + WeakRuleNode::from_ptr(self.p) } /// Get the parent rule node of this rule node. @@ -404,10 +404,10 @@ impl StrongRuleNode { key, |node| unsafe { (*node.ptr()).key() }, move || { - let root = root.downgrade(); + let root = unsafe { root.downgrade() }; let strong = StrongRuleNode::new(Box::new(RuleNode::new(root, self.clone(), source, level))); - let weak = strong.downgrade(); + let weak = unsafe { strong.downgrade() }; mem::forget(strong); weak },