Skip to content

Commit 33f8c36

Browse files
tmmcguireemberian
authored andcommitted
---
yaml --- r: 61415 b: refs/heads/try c: 5948d8a h: refs/heads/master i: 61413: aac9dbd 61411: ddf425d 61407: dd7e0ae v: v3
1 parent c4c2dff commit 33f8c36

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5-
refs/heads/try: 2264c7927dbfc6124b9b756de47200ded1ca76ac
5+
refs/heads/try: 5948d8a8260e0c3da4f58f7bd1081add1fd63e58
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/vec.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,9 @@ pub fn reverse<T>(v: &mut [T]) {
14501450
*
14511451
* Reverse the elements in the vector between `start` and `end - 1`.
14521452
*
1453+
* If either start or end do not represent valid positions in the vector, the
1454+
* vector is returned unchanged.
1455+
*
14531456
* # Arguments
14541457
*
14551458
* * `v` - The mutable vector to be modified
@@ -1469,13 +1472,10 @@ pub fn reverse<T>(v: &mut [T]) {
14691472
* ~~~
14701473
*
14711474
* `v` now contains `[1,4,3,2,5]`.
1472-
*
1473-
* # Safety note
1474-
*
1475-
* Behavior is undefined if `start` or `end` do not represent valid
1476-
* positions in `v`.
14771475
*/
14781476
pub fn reverse_part<T>(v: &mut [T], start: uint, end : uint) {
1477+
let sz = v.len();
1478+
if start >= sz || end > sz { return; }
14791479
let mut i = start;
14801480
let mut j = end - 1;
14811481
while i < j {

0 commit comments

Comments
 (0)