From c0e150a2a65a762281ff5d28be8574cf6b207594 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Thu, 8 Dec 2016 22:37:36 +0100 Subject: [PATCH] Inline nested fn collapse Since merge_sort is generic and collapse isn't, that means calls to collapse won't be inlined. inlined. Therefore, we must stick an `#[inline]` above `fn collapse`. --- src/libcollections/slice.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index d180d6f2edda3..5fb8cd6e1e2b7 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1611,6 +1611,7 @@ fn merge_sort(v: &mut [T], mut compare: F) // This function correctly checks invariants for the top four runs. Additionally, if the top // run starts at index 0, it will always demand a merge operation until the stack is fully // collapsed, in order to complete the sort. + #[inline] fn collapse(runs: &[Run]) -> Option { let n = runs.len(); if n >= 2 && (runs[n - 1].start == 0 ||