From bbbb80559c8e321dc023c48579367e2ef1349b4b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 17 Jan 2013 16:15:08 -0800 Subject: librustc: Disallow `&mut` loans from overlapping with any other loans --- src/libstd/sort.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index cce3dc725da..3017d95f2a7 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -630,9 +630,15 @@ impl MergeState { dest -= 1; c2 -= 1; len2 -= 1; if len2 == 1 { break_outer = true; break; } - let tmp_view = vec::mut_view(tmp, 0, len2); - let count2 = len2 - gallop_left(&const array[c1], - tmp_view, len2-1); + let count2; + { + let tmp_view = vec::mut_view(tmp, 0, len2); + count2 = len2 - gallop_left(&const array[c1], + tmp_view, + len2-1); + // Make tmp_view go out of scope to appease borrowck. + } + if count2 != 0 { dest -= count2; c2 -= count2; len2 -= count2; copy_vec(array, dest+1, tmp, c2+1, count2); -- cgit 1.4.1-3-g733a5