@@ -102,7 +102,7 @@ impl<T, ProducerAddition, ConsumerAddition> Queue<T, ProducerAddition, ConsumerA
102
102
) -> Self {
103
103
let n1 = Node :: new ( ) ;
104
104
let n2 = Node :: new ( ) ;
105
- ( * n1) . next . store ( n2, Ordering :: Relaxed ) ;
105
+ ( & ( * n1) . next ) . store ( n2, Ordering :: Relaxed ) ;
106
106
Queue {
107
107
consumer : CacheAligned :: new ( Consumer {
108
108
tail : UnsafeCell :: new ( n2) ,
@@ -127,10 +127,10 @@ impl<T, ProducerAddition, ConsumerAddition> Queue<T, ProducerAddition, ConsumerA
127
127
// Acquire a node (which either uses a cached one or allocates a new
128
128
// one), and then append this to the 'head' node.
129
129
let n = self . alloc ( ) ;
130
- assert ! ( ( * n) . value. is_none( ) ) ;
130
+ assert ! ( ( & ( * n) . value) . is_none( ) ) ;
131
131
( * n) . value = Some ( t) ;
132
- ( * n) . next . store ( ptr:: null_mut ( ) , Ordering :: Relaxed ) ;
133
- ( * * self . producer . head . get ( ) ) . next . store ( n, Ordering :: Release ) ;
132
+ ( & ( * n) . next ) . store ( ptr:: null_mut ( ) , Ordering :: Relaxed ) ;
133
+ ( & ( * * self . producer . head . get ( ) ) . next ) . store ( n, Ordering :: Release ) ;
134
134
* ( & self . producer . head ) . get ( ) = n;
135
135
}
136
136
}
@@ -139,15 +139,15 @@ impl<T, ProducerAddition, ConsumerAddition> Queue<T, ProducerAddition, ConsumerA
139
139
// First try to see if we can consume the 'first' node for our uses.
140
140
if * self . producer . first . get ( ) != * self . producer . tail_copy . get ( ) {
141
141
let ret = * self . producer . first . get ( ) ;
142
- * self . producer . 0 . first . get ( ) = ( * ret) . next . load ( Ordering :: Relaxed ) ;
142
+ * self . producer . 0 . first . get ( ) = ( & ( * ret) . next ) . load ( Ordering :: Relaxed ) ;
143
143
return ret;
144
144
}
145
145
// If the above fails, then update our copy of the tail and try
146
146
// again.
147
147
* self . producer . 0 . tail_copy . get ( ) = self . consumer . tail_prev . load ( Ordering :: Acquire ) ;
148
148
if * self . producer . first . get ( ) != * self . producer . tail_copy . get ( ) {
149
149
let ret = * self . producer . first . get ( ) ;
150
- * self . producer . 0 . first . get ( ) = ( * ret) . next . load ( Ordering :: Relaxed ) ;
150
+ * self . producer . 0 . first . get ( ) = ( & ( * ret) . next ) . load ( Ordering :: Relaxed ) ;
151
151
return ret;
152
152
}
153
153
// If all of that fails, then we have to allocate a new node
@@ -164,12 +164,12 @@ impl<T, ProducerAddition, ConsumerAddition> Queue<T, ProducerAddition, ConsumerA
164
164
// tail's next field and see if we can use it. If we do a pop, then
165
165
// the current tail node is a candidate for going into the cache.
166
166
let tail = * self . consumer . tail . get ( ) ;
167
- let next = ( * tail) . next . load ( Ordering :: Acquire ) ;
167
+ let next = ( & ( * tail) . next ) . load ( Ordering :: Acquire ) ;
168
168
if next. is_null ( ) {
169
169
return None ;
170
170
}
171
- assert ! ( ( * next) . value. is_some( ) ) ;
172
- let ret = ( * next) . value . take ( ) ;
171
+ assert ! ( ( & ( * next) . value) . is_some( ) ) ;
172
+ let ret = ( & mut ( * next) . value ) . take ( ) ;
173
173
174
174
* self . consumer . 0 . tail . get ( ) = next;
175
175
if self . consumer . cache_bound == 0 {
@@ -184,8 +184,7 @@ impl<T, ProducerAddition, ConsumerAddition> Queue<T, ProducerAddition, ConsumerA
184
184
if ( * tail) . cached {
185
185
self . consumer . tail_prev . store ( tail, Ordering :: Release ) ;
186
186
} else {
187
- ( * self . consumer . tail_prev . load ( Ordering :: Relaxed ) )
188
- . next
187
+ ( & ( * self . consumer . tail_prev . load ( Ordering :: Relaxed ) ) . next )
189
188
. store ( next, Ordering :: Relaxed ) ;
190
189
// We have successfully erased all references to 'tail', so
191
190
// now we can safely drop it.
@@ -208,8 +207,8 @@ impl<T, ProducerAddition, ConsumerAddition> Queue<T, ProducerAddition, ConsumerA
208
207
// stripped out.
209
208
unsafe {
210
209
let tail = * self . consumer . tail . get ( ) ;
211
- let next = ( * tail) . next . load ( Ordering :: Acquire ) ;
212
- if next. is_null ( ) { None } else { ( * next) . value . as_mut ( ) }
210
+ let next = ( & ( * tail) . next ) . load ( Ordering :: Acquire ) ;
211
+ if next. is_null ( ) { None } else { ( & mut ( * next) . value ) . as_mut ( ) }
213
212
}
214
213
}
215
214
@@ -227,7 +226,7 @@ impl<T, ProducerAddition, ConsumerAddition> Drop for Queue<T, ProducerAddition,
227
226
unsafe {
228
227
let mut cur = * self . producer . first . get ( ) ;
229
228
while !cur. is_null ( ) {
230
- let next = ( * cur) . next . load ( Ordering :: Relaxed ) ;
229
+ let next = ( & ( * cur) . next ) . load ( Ordering :: Relaxed ) ;
231
230
let _n: Box < Node < T > > = Box :: from_raw ( cur) ;
232
231
cur = next;
233
232
}
0 commit comments