about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStjepan Glavina <stjepang@gmail.com>2016-12-08 22:37:36 +0100
committerStjepan Glavina <stjepang@gmail.com>2016-12-08 22:37:36 +0100
commitc0e150a2a65a762281ff5d28be8574cf6b207594 (patch)
tree61c445460caad72680ef481394e5d77fcffa0d1a
parentc8d73ea68a9fbd127d7b78b4c167f0b80523ab7b (diff)
downloadrust-c0e150a2a65a762281ff5d28be8574cf6b207594.tar.gz
rust-c0e150a2a65a762281ff5d28be8574cf6b207594.zip
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`.
-rw-r--r--src/libcollections/slice.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index d180d6f2edd..5fb8cd6e1e2 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -1611,6 +1611,7 @@ fn merge_sort<T, F>(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<usize> {
         let n = runs.len();
         if n >= 2 && (runs[n - 1].start == 0 ||