mirror of
https://github.com/servo/servo.git
synced 2025-07-03 13:33:39 +01:00
Add some FIXME comments about using ptr::NonNull
This commit is contained in:
parent
b78ac6ba6a
commit
4be3096040
3 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
use std::marker::PhantomData;
|
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);
|
pub struct NonZeroPtr<T: 'static>(&'static T);
|
||||||
|
|
||||||
impl<T: 'static> NonZeroPtr<T> {
|
impl<T: 'static> NonZeroPtr<T> {
|
||||||
|
|
|
@ -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.
|
/// that this is all a temporary hack, this restriction is fine for now.
|
||||||
///
|
///
|
||||||
/// [1]: https://github.com/rust-lang/rust/issues/27730
|
/// [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);
|
pub struct NonZeroPtrMut<T: ?Sized + 'static>(&'static mut T);
|
||||||
impl<T: ?Sized> NonZeroPtrMut<T> {
|
impl<T: ?Sized> NonZeroPtrMut<T> {
|
||||||
pub fn new(ptr: *mut T) -> Self {
|
pub fn new(ptr: *mut T) -> Self {
|
||||||
|
|
|
@ -828,6 +828,8 @@ impl MallocSizeOf for RuleNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: use std::ptr::NonNull when Firefox requires Rust 1.25+
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct WeakRuleNode {
|
struct WeakRuleNode {
|
||||||
p: NonZeroPtrMut<RuleNode>,
|
p: NonZeroPtrMut<RuleNode>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue