File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -194,11 +194,10 @@ where
194
194
) ;
195
195
}
196
196
197
- // Drop any remaining values at the tail of the source but prevent drop of the allocation
198
- // itself once IntoIter goes out of scope.
199
- // If the drop panics then we also try to drop the destination buffer and its elements.
197
+ // The ownership of the allocation and the new `T` values is temporarily moved into `dst_guard`.
200
198
// This is safe because `forget_allocation_drop_remaining` immediately forgets the allocation
201
- // and won't panic before that.
199
+ // before any panic can occur in order to avoid any double free, and then proceeds to drop
200
+ // any remaining values at the tail of the source.
202
201
//
203
202
// Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
204
203
// contract (used by SpecInPlaceCollect below). But see the "O(1) collect" section in the
You can’t perform that action at this time.
0 commit comments