File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -100,8 +100,10 @@ macro_rules! zip_impl {
100
100
// Create a partial result for the contiguous slice of data being written to
101
101
let output = zip. last_producer( ) ;
102
102
debug_assert!( output. is_contiguous( ) ) ;
103
-
104
- let mut partial = Partial :: new( output. as_ptr( ) ) ;
103
+ let mut partial;
104
+ unsafe {
105
+ partial = Partial :: new( output. as_ptr( ) ) ;
106
+ }
105
107
106
108
// Apply the mapping function on this chunk of the zip
107
109
let partial_len = & mut partial. len;
@@ -173,7 +175,12 @@ pub(crate) struct Partial<T> {
173
175
174
176
impl < T > Partial < T > {
175
177
/// Create an empty partial for this data pointer
176
- pub ( crate ) fn new ( ptr : * mut T ) -> Self {
178
+ ///
179
+ /// Safety: Unless ownership is released, the
180
+ /// Partial acts as an owner of the slice of data (not the allocation);
181
+ /// and will free the elements on drop; the pointer must be dereferenceable
182
+ /// and the `len` elements following it valid.
183
+ pub ( crate ) unsafe fn new ( ptr : * mut T ) -> Self {
177
184
Self {
178
185
ptr,
179
186
len : 0 ,
You can’t perform that action at this time.
0 commit comments