diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index cfdb406f711..af150994765 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -238,7 +238,7 @@ pub trait SlicePrelude for Sized? { /// assert!(match r { Found(1...4) => true, _ => false, }); /// ``` #[unstable = "waiting on unboxed closures"] - fn binary_search(&self, f: |&T| -> Ordering) -> BinarySearchResult; + fn binary_search(&self, f: F) -> BinarySearchResult where F: FnMut(&T) -> Ordering; /// Return the number of elements in the slice /// @@ -552,7 +552,7 @@ impl SlicePrelude for [T] { } #[unstable] - fn binary_search(&self, f: |&T| -> Ordering) -> BinarySearchResult { + fn binary_search(&self, mut f: F) -> BinarySearchResult where F: FnMut(&T) -> Ordering { let mut base : uint = 0; let mut lim : uint = self.len();