File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -194,11 +194,10 @@ where
194194 ) ;
195195 }
196196
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`.
200198 // 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.
202201 //
203202 // Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
204203 // 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