diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2017-12-22 18:58:39 +0100 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-01-20 10:55:16 +0100 |
| commit | f19baf0977b176ba26277af479a19b71b7ee1fdb (patch) | |
| tree | 7c6eb9b86822c1dbca2535ea0b34569e3d65eb7a /src/liballoc/linked_list.rs | |
| parent | ba5d7a66e847f5713633cb792c379a11b774e21f (diff) | |
| download | rust-f19baf0977b176ba26277af479a19b71b7ee1fdb.tar.gz rust-f19baf0977b176ba26277af479a19b71b7ee1fdb.zip | |
Rename std::ptr::Shared to NonNull
`Shared` is now a deprecated `type` alias. CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
Diffstat (limited to 'src/liballoc/linked_list.rs')
| -rw-r--r-- | src/liballoc/linked_list.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/liballoc/linked_list.rs b/src/liballoc/linked_list.rs index 3ac5a85d721..e6e84101275 100644 --- a/src/liballoc/linked_list.rs +++ b/src/liballoc/linked_list.rs @@ -29,7 +29,7 @@ use core::iter::{FromIterator, FusedIterator}; use core::marker::PhantomData; use core::mem; use core::ops::{BoxPlace, InPlace, Place, Placer}; -use core::ptr::{self, Shared}; +use core::ptr::{self, NonNull}; use boxed::{Box, IntermediateBox}; use super::SpecExtend; @@ -44,15 +44,15 @@ use super::SpecExtend; /// more memory efficient and make better use of CPU cache. #[stable(feature = "rust1", since = "1.0.0")] pub struct LinkedList<T> { - head: Option<Shared<Node<T>>>, - tail: Option<Shared<Node<T>>>, + head: Option<NonNull<Node<T>>>, + tail: Option<NonNull<Node<T>>>, len: usize, marker: PhantomData<Box<Node<T>>>, } struct Node<T> { - next: Option<Shared<Node<T>>>, - prev: Option<Shared<Node<T>>>, + next: Option<NonNull<Node<T>>>, + prev: Option<NonNull<Node<T>>>, element: T, } @@ -65,8 +65,8 @@ struct Node<T> { /// [`LinkedList`]: struct.LinkedList.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T: 'a> { - head: Option<Shared<Node<T>>>, - tail: Option<Shared<Node<T>>>, + head: Option<NonNull<Node<T>>>, + tail: Option<NonNull<Node<T>>>, len: usize, marker: PhantomData<&'a Node<T>>, } @@ -98,8 +98,8 @@ impl<'a, T> Clone for Iter<'a, T> { #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, T: 'a> { list: &'a mut LinkedList<T>, - head: Option<Shared<Node<T>>>, - tail: Option<Shared<Node<T>>>, + head: Option<NonNull<Node<T>>>, + tail: Option<NonNull<Node<T>>>, len: usize, } @@ -157,7 +157,7 @@ impl<T> LinkedList<T> { unsafe { node.next = self.head; node.prev = None; - let node = Some(Shared::from(Box::into_unique(node))); + let node = Some(NonNull::from(Box::into_unique(node))); match self.head { None => self.tail = node, @@ -192,7 +192,7 @@ impl<T> LinkedList<T> { unsafe { node.next = None; node.prev = self.tail; - let node = Some(Shared::from(Box::into_unique(node))); + let node = Some(NonNull::from(Box::into_unique(node))); match self.tail { None => self.head = node, @@ -225,7 +225,7 @@ impl<T> LinkedList<T> { /// /// Warning: this will not check that the provided node belongs to the current list. #[inline] - unsafe fn unlink_node(&mut self, mut node: Shared<Node<T>>) { + unsafe fn unlink_node(&mut self, mut node: NonNull<Node<T>>) { let node = node.as_mut(); match node.prev { @@ -986,7 +986,7 @@ impl<'a, T> IterMut<'a, T> { Some(prev) => prev, }; - let node = Some(Shared::from(Box::into_unique(box Node { + let node = Some(NonNull::from(Box::into_unique(box Node { next: Some(head), prev: Some(prev), element, @@ -1038,7 +1038,7 @@ pub struct DrainFilter<'a, T: 'a, F: 'a> where F: FnMut(&mut T) -> bool, { list: &'a mut LinkedList<T>, - it: Option<Shared<Node<T>>>, + it: Option<NonNull<Node<T>>>, pred: F, idx: usize, old_len: usize, |
