Bug 1631154 - Make WeakRuleNode::from_ptr be unsafe. r=emilio

This commit is contained in:
Anthony Ramine 2020-04-16 14:39:14 +02:00 коммит произвёл Emilio Cobos Álvarez
Родитель 47d8182814
Коммит f71e5d7ef4
1 изменённых файлов: 2 добавлений и 8 удалений

Просмотреть файл

@ -369,7 +369,7 @@ impl StrongRuleNode {
} }
pub(super) fn downgrade(&self) -> WeakRuleNode { pub(super) fn downgrade(&self) -> WeakRuleNode {
WeakRuleNode::from_ptr(self.p) unsafe { WeakRuleNode::from_ptr(self.p) }
} }
/// Get the parent rule node of this rule node. /// Get the parent rule node of this rule node.
@ -750,12 +750,6 @@ impl Drop for StrongRuleNode {
} }
} }
impl<'a> From<&'a StrongRuleNode> for WeakRuleNode {
fn from(node: &'a StrongRuleNode) -> Self {
WeakRuleNode::from_ptr(node.p)
}
}
impl WeakRuleNode { impl WeakRuleNode {
#[inline] #[inline]
fn ptr(&self) -> *mut RuleNode { fn ptr(&self) -> *mut RuleNode {
@ -770,7 +764,7 @@ impl WeakRuleNode {
unsafe { StrongRuleNode::from_ptr(self.p) } unsafe { StrongRuleNode::from_ptr(self.p) }
} }
fn from_ptr(p: ptr::NonNull<RuleNode>) -> Self { unsafe fn from_ptr(p: ptr::NonNull<RuleNode>) -> Self {
WeakRuleNode { p } WeakRuleNode { p }
} }
} }