]> git.lizzy.rs Git - rust.git/commitdiff
Clarify dst condition
authorPazzaz <pazzaz.sundqvist@gmail.com>
Tue, 14 Aug 2018 18:56:22 +0000 (20:56 +0200)
committerPazzaz <pazzaz.sundqvist@gmail.com>
Tue, 14 Aug 2018 18:56:22 +0000 (20:56 +0200)
src/liballoc/collections/vec_deque.rs

index b66bb82bc37b59f2383ab753e73bff3c8e3abd0c..95d4b918df3195bcccf9e46ea99cb1ca9c4e5ee2 100644 (file)
@@ -1882,18 +1882,18 @@ unsafe fn copy_whole_slice<T>(src_slice: &[T], dst_slice: &mut [T]) {
             // Values are not copied one by one but as slices in `copy_whole_slice`.
             // What slices are used depends on various properties of src and dst.
             // There are 6 cases in total:
-            //     1. `src` and `dst` are contiguous
-            //     2. `src` is contiguous and `dst` is discontiguous
-            //     3. `src` is discontiguous and `dst` is contiguous
-            //     4. `src` and `dst` are discontiguous
+            //     1. `src` is contiguous and fits in dst_high
+            //     2. `src` is contiguous and does not fit in dst_high
+            //     3. `src` is discontiguous and fits in dst_high
+            //     4. `src` is discontiguous and does not fit in dst_high
             //        + src_high is smaller than dst_high
-            //     5. `src` and `dst` are discontiguous
+            //     5. `src` is discontiguous and does not fit in dst_high
             //        + dst_high is smaller than src_high
-            //     6. `src` and `dst` are discontiguous
+            //     6. `src` is discontiguous and does not fit in dst_high
             //        + dst_high is the same size as src_high
             let src_contiguous = src_low.is_empty();
-            let dst_contiguous = dst_high.len() >= src_total;
-            match (src_contiguous, dst_contiguous) {
+            let dst_high_fits_src = dst_high.len() >= src_total;
+            match (src_contiguous, dst_high_fits_src) {
                 (true, true) => {
                     // 1.
                     // other [. . . o o o . . . . . .]