File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,8 +100,10 @@ macro_rules! zip_impl {
100100 // Create a partial result for the contiguous slice of data being written to
101101 let output = zip. last_producer( ) ;
102102 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+ }
105107
106108 // Apply the mapping function on this chunk of the zip
107109 let partial_len = & mut partial. len;
@@ -173,7 +175,12 @@ pub(crate) struct Partial<T> {
173175
174176impl < T > Partial < T > {
175177 /// 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 {
177184 Self {
178185 ptr,
179186 len : 0 ,
You can’t perform that action at this time.
0 commit comments