Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make StrongRuleNode::downgrade be unsafe
  • Loading branch information
nox committed Apr 17, 2020
1 parent fb28ce6 commit bc4e294
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/style/rule_tree/core.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -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
},
Expand Down

0 comments on commit bc4e294

Please sign in to comment.