@@ -2378,7 +2378,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
23782378 }
23792379
23802380 /// Binary searches this `VecDeque` for a given element.
2381- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2381+ /// If the `VecDeque` is not sorted, the returned result is unspecified and
2382+ /// meaningless.
23822383 ///
23832384 /// If the value is found then [`Result::Ok`] is returned, containing the
23842385 /// index of the matching element. If there are multiple matches, then any
@@ -2434,12 +2435,13 @@ impl<T, A: Allocator> VecDeque<T, A> {
24342435 }
24352436
24362437 /// Binary searches this `VecDeque` with a comparator function.
2437- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
24382438 ///
2439- /// The comparator function should implement an order consistent
2440- /// with the sort order of the deque, returning an order code that
2441- /// indicates whether its argument is `Less`, `Equal` or `Greater`
2442- /// than the desired target.
2439+ /// The comparator function should return an order code that indicates
2440+ /// whether its argument is `Less`, `Equal` or `Greater` the desired
2441+ /// target.
2442+ /// If the `VecDeque` is not sorted or if the comparator function does not
2443+ /// implement an order consistent with the sort order of the underlying
2444+ /// `VecDeque`, the returned result is unspecified and meaningless.
24432445 ///
24442446 /// If the value is found then [`Result::Ok`] is returned, containing the
24452447 /// index of the matching element. If there are multiple matches, then any
@@ -2489,10 +2491,11 @@ impl<T, A: Allocator> VecDeque<T, A> {
24892491 }
24902492
24912493 /// Binary searches this `VecDeque` with a key extraction function.
2492- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
24932494 ///
24942495 /// Assumes that the deque is sorted by the key, for instance with
24952496 /// [`make_contiguous().sort_by_key()`] using the same key extraction function.
2497+ /// If the deque is not sorted by the key, the returned result is
2498+ /// unspecified and meaningless.
24962499 ///
24972500 /// If the value is found then [`Result::Ok`] is returned, containing the
24982501 /// index of the matching element. If there are multiple matches, then any
0 commit comments