Skip to content

Commit

Permalink
Auto merge of rust-lang#81312 - dylni:clarify-btree-range-search-comm…
Browse files Browse the repository at this point in the history
…ents, r=m-ou-se

Clarify BTree `range_search` comments

These comments were added by rust-lang#81169. However, the soundness issue [might not be exploitable here](rust-lang#81169 (comment)), so the comments should be updated.

cc `@ssomers`
  • Loading branch information
bors committed Mar 18, 2021
2 parents 2aafe45 + 35a2096 commit 895a8e7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions library/alloc/src/collections/btree/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ impl<BorrowType: marker::BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Lea
K: Borrow<Q>,
R: RangeBounds<Q>,
{
// WARNING: Inlining these variables would be unsound (#81138)
// We assume the bounds reported by `range` remain the same, but
// an adversarial implementation could change between calls
// Inlining these variables should be avoided. We assume the bounds reported by `range`
// remain the same, but an adversarial implementation could change between calls (#81138).
let (start, end) = (range.start_bound(), range.end_bound());
match (start, end) {
(Bound::Excluded(s), Bound::Excluded(e)) if s == e => {
Expand Down

0 comments on commit 895a8e7

Please sign in to comment.