From 93e6c26dcf557e4411eb033f0dd8f96401c879c6 Mon Sep 17 00:00:00 2001 From: djzin Date: Sat, 14 Jan 2017 17:06:00 +0000 Subject: [PATCH] update array_vec to use new rangeargument --- src/librustc_data_structures/array_vec.rs | 12 ++++++++++-- 1 file 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 ArrayVec { // 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);