From 4be30960400dc25c68d7d0cb8da2de3cc4682b56 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 22 Jan 2018 13:28:08 +0100 Subject: [PATCH] Add some FIXME comments about using ptr::NonNull --- components/hashglobe/src/shim.rs | 3 ++- components/servo_arc/lib.rs | 1 + components/style/rule_tree/mod.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/hashglobe/src/shim.rs b/components/hashglobe/src/shim.rs index 08fbf32b72f..146ff851a0e 100644 --- a/components/hashglobe/src/shim.rs +++ b/components/hashglobe/src/shim.rs @@ -1,5 +1,6 @@ use std::marker::PhantomData; +// FIXME: remove this and use std::ptr::NonNull when Firefox requires Rust 1.25+ pub struct NonZeroPtr(&'static T); impl NonZeroPtr { @@ -57,4 +58,4 @@ impl<'a, T> From<&'a mut T> for Shared { fn from(reference: &'a mut T) -> Self { unsafe { Shared::new_unchecked(reference) } } -} \ No newline at end of file +} diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index d7694901130..1301a8e6611 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -83,6 +83,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// that this is all a temporary hack, this restriction is fine for now. /// /// [1]: https://github.com/rust-lang/rust/issues/27730 +// FIXME: remove this and use std::ptr::NonNull when Firefox requires Rust 1.25+ pub struct NonZeroPtrMut(&'static mut T); impl NonZeroPtrMut { pub fn new(ptr: *mut T) -> Self { diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index e5b7e273885..2a137d7eb79 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -828,6 +828,8 @@ impl MallocSizeOf for RuleNode { } } +// FIXME: use std::ptr::NonNull when Firefox requires Rust 1.25+ + #[derive(Clone)] struct WeakRuleNode { p: NonZeroPtrMut,