about summary refs log tree commit diff
path: root/src/libcore/slice/mod.rs
diff options
context:
space:
mode:
authorStjepan Glavina <stjepang@gmail.com>2017-03-21 02:38:03 +0100
committerStjepan Glavina <stjepang@gmail.com>2017-03-21 20:46:20 +0100
commita718051f63308638ecf40a7570dbd18f4fc99703 (patch)
tree4a0c488b1fa8fcef586b4fc81459675435134e60 /src/libcore/slice/mod.rs
parenta18b2aa641da7c000fea9e9ac62d2da89fa034ad (diff)
Unit test heapsort
Diffstat (limited to 'src/libcore/slice/mod.rs')
-rw-r--r--src/libcore/slice/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index 53cbdd84c3a..6f8b199f886 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -2253,6 +2253,15 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] {
     mem::transmute(Repr { data: p, len: len })
 }
 
+// This function is public only because there is no other way to unit test heapsort.
+#[unstable(feature = "sort_internals", reason = "internal to sort module", issue = "0")]
+#[doc(hidden)]
+pub fn heapsort<T, F>(v: &mut [T], mut is_less: F)
+    where F: FnMut(&T, &T) -> bool
+{
+    sort::heapsort(v, &mut is_less);
+}
+
 //
 // Comparison traits
 //