about summary refs log tree commit diff
path: root/src/librustc_data_structures/array_vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc_data_structures/array_vec.rs')
-rw-r--r--src/librustc_data_structures/array_vec.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/librustc_data_structures/array_vec.rs b/src/librustc_data_structures/array_vec.rs
index 844e9041d20..9baaa44a370 100644
--- a/src/librustc_data_structures/array_vec.rs
+++ b/src/librustc_data_structures/array_vec.rs
@@ -119,8 +119,16 @@ impl<A: Array> ArrayVec<A> {
         // the hole, and the vector length is restored to the new length.
         //
         let len = self.len();
-        let start = *range.start().unwrap_or(&0);
-        let end = *range.end().unwrap_or(&len);
+        let start = match range.start() {
+            Included(&n) => n,
+            Excluded(&n) => n + 1,
+            Unbounded    => 0,
+        };
+        let end = match range.end() {
+            Included(&n) => n + 1,
+            Excluded(&n) => n,
+            Unbounded    => len,
+        };
         assert!(start <= end);
         assert!(end <= len);