From 05accaa7bd3ac0e0cc34626937499209973ccc77 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 16 Apr 2020 14:34:24 +0200 Subject: [PATCH] Make StrongRuleNode::from_ptr be unsafe --- components/style/rule_tree/core.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/style/rule_tree/core.rs b/components/style/rule_tree/core.rs index 3103d416aec..0b1afd8548a 100644 --- a/components/style/rule_tree/core.rs +++ b/components/style/rule_tree/core.rs @@ -361,10 +361,10 @@ impl StrongRuleNode { debug!("Creating rule node: {:p}", ptr); - StrongRuleNode::from_ptr(ptr) + unsafe { StrongRuleNode::from_ptr(ptr) } } - fn from_ptr(p: ptr::NonNull) -> Self { + unsafe fn from_ptr(p: ptr::NonNull) -> Self { StrongRuleNode { p } } @@ -413,7 +413,7 @@ impl StrongRuleNode { }, ); - StrongRuleNode::from_ptr(weak.p) + unsafe { StrongRuleNode::from_ptr(weak.p) } } /// Raw pointer to the RuleNode @@ -606,7 +606,7 @@ impl Clone for StrongRuleNode { ); debug_assert!(self.get().refcount.load(Ordering::Relaxed) > 0); self.get().refcount.fetch_add(1, Ordering::Relaxed); - StrongRuleNode::from_ptr(self.p) + unsafe { StrongRuleNode::from_ptr(self.p) } } } @@ -767,7 +767,7 @@ impl WeakRuleNode { let node = unsafe { &*self.ptr() }; node.refcount.fetch_add(1, Ordering::Relaxed); - StrongRuleNode::from_ptr(self.p) + unsafe { StrongRuleNode::from_ptr(self.p) } } fn from_ptr(p: ptr::NonNull) -> Self {