Skip to content

Commit

Permalink
Add some FIXME comments about using ptr::NonNull
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Jan 22, 2018
1 parent b78ac6b commit 4be3096
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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<T: 'static>(&'static T);

impl<T: 'static> NonZeroPtr<T> {
Expand Down Expand Up @@ -57,4 +58,4 @@ impl<'a, T> From<&'a mut T> for Shared<T> {
fn from(reference: &'a mut T) -> Self {
unsafe { Shared::new_unchecked(reference) }
}
}
}
1 change: 1 addition & 0 deletions components/servo_arc/lib.rs
Expand Up @@ -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<T: ?Sized + 'static>(&'static mut T);
impl<T: ?Sized> NonZeroPtrMut<T> {
pub fn new(ptr: *mut T) -> Self {
Expand Down
2 changes: 2 additions & 0 deletions components/style/rule_tree/mod.rs
Expand Up @@ -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<RuleNode>,
Expand Down

0 comments on commit 4be3096

Please sign in to comment.