Instruct LLVM that binary_search_by returns a valid index

This commit is contained in:
Giacomo Stevanato 2021-01-24 21:04:18 +01:00
parent 51748a8fc7
commit f43c02236d

View file

@ -2204,6 +2204,8 @@ impl<T> [T] {
} else if cmp == Greater {
right = mid;
} else {
// SAFETY: same as the `get_unchecked` above
unsafe { crate::intrinsics::assume(mid < self.len()) };
return Ok(mid);
}