@@ -135,25 +135,25 @@ const SEGMENT_LOGSIZE: usize = 10;
135
135
136
136
/// A fixed size array of atomic pointers to other `Segment<T>` or `T`.
137
137
///
138
- /// Each segment is either a child segment with pointers to `Segment<T>` or an element segment with
139
- /// pointers to `T`. This is determined by the height of this segment in the main array, which one
140
- /// needs to track separately. For example, use the main array root's tag.
138
+ /// Each segment is either an inner segment with pointers to other, children `Segment<T>` or an
139
+ /// element segment with pointers to `T`. This is determined by the height of this segment in the
140
+ /// main array, which one needs to track separately. For example, use the main array root's tag.
141
141
///
142
- /// Since destructing segments requires its height information, it is not recommended to
143
- /// implement [`Drop`]. Rather, implement and use the custom [`Segment::deallocate`] method that
144
- /// accounts for the height of the segment.
142
+ /// Since destructing segments requires its height information, it is not recommended to implement
143
+ /// [`Drop`]. Rather, implement and use the custom [`Segment::deallocate`] method that accounts for
144
+ /// the height of the segment.
145
145
union Segment < T > {
146
146
children : ManuallyDrop < [ Atomic < Segment < T > > ; 1 << SEGMENT_LOGSIZE ] > ,
147
147
elements : ManuallyDrop < [ Atomic < T > ; 1 << SEGMENT_LOGSIZE ] > ,
148
148
}
149
149
150
150
impl < T > Segment < T > {
151
151
/// Create a new segment filled with null pointers. It is up to the callee to whether to use
152
- /// this as a children or an element segment.
152
+ /// this as an intermediate or an element segment.
153
153
fn new ( ) -> Owned < Self > {
154
154
Owned :: new (
155
- // SAFETY: An array of null pointers can be interperted as either an element segment or
156
- // a children segment.
155
+ // SAFETY: An array of null pointers can be interperted as either an intermediate
156
+ // segment or an element segment.
157
157
unsafe { mem:: zeroed ( ) } ,
158
158
)
159
159
}
@@ -162,7 +162,8 @@ impl<T> Segment<T> {
162
162
///
163
163
/// # Safety
164
164
///
165
- /// `self` must actually have height `height`.
165
+ /// - `self` must actually have height `height`.
166
+ /// - There should be no other references to possible children segments.
166
167
unsafe fn deallocate ( self , height : usize ) {
167
168
todo ! ( )
168
169
}
@@ -197,7 +198,7 @@ impl<T> GrowableArray<T> {
197
198
198
199
/// Returns the reference to the `Atomic` pointer at `index`. Allocates new segments if
199
200
/// necessary.
200
- pub fn get < ' g > ( & self , mut index : usize , guard : & ' g Guard ) -> & ' g Atomic < T > {
201
+ pub fn get < ' g > ( & self , index : usize , guard : & ' g Guard ) -> & ' g Atomic < T > {
201
202
todo ! ( )
202
203
}
203
204
}
0 commit comments