Skip to content

Commit d4432a7

Browse files
committed
Remove some unused MergeState code, add a Fixme and remove a workaround involving pure code not being considered pure
1 parent f2216ec commit d4432a7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/libstd/sort.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ pub fn tim_sort<T: Copy Ord>(array: &[mut T]) {
179179
}
180180

181181
let ms = &MergeState();
182-
ms.array = array;
183182
let min_run = min_run_length(size);
184183

185184
let mut idx = 0;
@@ -383,14 +382,13 @@ struct RunState {
383382

384383
struct MergeState<T> {
385384
mut min_gallop: uint,
386-
mut array: &[mut T],
387385
runs: DVec<RunState>,
388386
}
389387

388+
// Fixme (#3853) Move into MergeState
390389
fn MergeState<T>() -> MergeState<T> {
391390
MergeState {
392391
min_gallop: MIN_GALLOP,
393-
array: &[mut],
394392
runs: DVec(),
395393
}
396394
}
@@ -500,9 +498,8 @@ impl<T: Copy Ord> MergeState<T> {
500498
loop {
501499
assert len1 > 1 && len2 != 0;
502500

503-
//let tmp_view = vec::const_view(tmp, c1, c1+len1);
504-
count1 = gallop_right(&const array[c2],
505-
vec::const_view(tmp, c1, c1+len1), 0);
501+
let tmp_view = vec::const_view(tmp, c1, c1+len1);
502+
count1 = gallop_right(&const array[c2], tmp_view, 0);
506503
if count1 != 0 {
507504
copy_vec(array, dest, tmp, c1, count1);
508505
dest += count1; c1 += count1; len1 -= count1;
@@ -620,9 +617,9 @@ impl<T: Copy Ord> MergeState<T> {
620617
dest -= 1; c2 -= 1; len2 -= 1;
621618
if len2 == 1 { break_outer = true; break; }
622619
623-
//let tmp_view = vec::mut_view(tmp, 0, len2);
620+
let tmp_view = vec::mut_view(tmp, 0, len2);
624621
let count2 = len2 - gallop_left(&const array[c1],
625-
vec::mut_view(tmp, 0, len2), len2-1);
622+
tmp_view, len2-1);
626623
if count2 != 0 {
627624
dest -= count2; c2 -= count2; len2 -= count2;
628625
copy_vec(array, dest+1, tmp, c2+1, count2);

0 commit comments

Comments
 (0)