@@ -29,7 +29,7 @@ use core::iter::{FromIterator, FusedIterator};
29
29
use core:: marker:: PhantomData ;
30
30
use core:: mem;
31
31
use core:: ops:: { BoxPlace , InPlace , Place , Placer } ;
32
- use core:: ptr:: { self , Shared } ;
32
+ use core:: ptr:: { self , NonNull } ;
33
33
34
34
use boxed:: { Box , IntermediateBox } ;
35
35
use super :: SpecExtend ;
@@ -44,15 +44,15 @@ use super::SpecExtend;
44
44
/// more memory efficient and make better use of CPU cache.
45
45
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
46
46
pub struct LinkedList < T > {
47
- head : Option < Shared < Node < T > > > ,
48
- tail : Option < Shared < Node < T > > > ,
47
+ head : Option < NonNull < Node < T > > > ,
48
+ tail : Option < NonNull < Node < T > > > ,
49
49
len : usize ,
50
50
marker : PhantomData < Box < Node < T > > > ,
51
51
}
52
52
53
53
struct Node < T > {
54
- next : Option < Shared < Node < T > > > ,
55
- prev : Option < Shared < Node < T > > > ,
54
+ next : Option < NonNull < Node < T > > > ,
55
+ prev : Option < NonNull < Node < T > > > ,
56
56
element : T ,
57
57
}
58
58
@@ -65,8 +65,8 @@ struct Node<T> {
65
65
/// [`LinkedList`]: struct.LinkedList.html
66
66
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
67
67
pub struct Iter < ' a , T : ' a > {
68
- head : Option < Shared < Node < T > > > ,
69
- tail : Option < Shared < Node < T > > > ,
68
+ head : Option < NonNull < Node < T > > > ,
69
+ tail : Option < NonNull < Node < T > > > ,
70
70
len : usize ,
71
71
marker : PhantomData < & ' a Node < T > > ,
72
72
}
@@ -98,8 +98,8 @@ impl<'a, T> Clone for Iter<'a, T> {
98
98
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
99
99
pub struct IterMut < ' a , T : ' a > {
100
100
list : & ' a mut LinkedList < T > ,
101
- head : Option < Shared < Node < T > > > ,
102
- tail : Option < Shared < Node < T > > > ,
101
+ head : Option < NonNull < Node < T > > > ,
102
+ tail : Option < NonNull < Node < T > > > ,
103
103
len : usize ,
104
104
}
105
105
@@ -157,7 +157,7 @@ impl<T> LinkedList<T> {
157
157
unsafe {
158
158
node. next = self . head ;
159
159
node. prev = None ;
160
- let node = Some ( Shared :: from ( Box :: into_unique ( node) ) ) ;
160
+ let node = Some ( NonNull :: from ( Box :: into_unique ( node) ) ) ;
161
161
162
162
match self . head {
163
163
None => self . tail = node,
@@ -192,7 +192,7 @@ impl<T> LinkedList<T> {
192
192
unsafe {
193
193
node. next = None ;
194
194
node. prev = self . tail ;
195
- let node = Some ( Shared :: from ( Box :: into_unique ( node) ) ) ;
195
+ let node = Some ( NonNull :: from ( Box :: into_unique ( node) ) ) ;
196
196
197
197
match self . tail {
198
198
None => self . head = node,
@@ -225,7 +225,7 @@ impl<T> LinkedList<T> {
225
225
///
226
226
/// Warning: this will not check that the provided node belongs to the current list.
227
227
#[ inline]
228
- unsafe fn unlink_node ( & mut self , mut node : Shared < Node < T > > ) {
228
+ unsafe fn unlink_node ( & mut self , mut node : NonNull < Node < T > > ) {
229
229
let node = node. as_mut ( ) ;
230
230
231
231
match node. prev {
@@ -986,7 +986,7 @@ impl<'a, T> IterMut<'a, T> {
986
986
Some ( prev) => prev,
987
987
} ;
988
988
989
- let node = Some ( Shared :: from ( Box :: into_unique ( box Node {
989
+ let node = Some ( NonNull :: from ( Box :: into_unique ( box Node {
990
990
next : Some ( head) ,
991
991
prev : Some ( prev) ,
992
992
element,
@@ -1038,7 +1038,7 @@ pub struct DrainFilter<'a, T: 'a, F: 'a>
1038
1038
where F : FnMut ( & mut T ) -> bool ,
1039
1039
{
1040
1040
list : & ' a mut LinkedList < T > ,
1041
- it : Option < Shared < Node < T > > > ,
1041
+ it : Option < NonNull < Node < T > > > ,
1042
1042
pred : F ,
1043
1043
idx : usize ,
1044
1044
old_len : usize ,
0 commit comments