We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ced089 commit 97bc528Copy full SHA for 97bc528
compiler/rustc_data_structures/src/binary_search_util/mod.rs
@@ -14,18 +14,14 @@ where
14
let start = data.partition_point(|x| key_fn(x) < *key);
15
// At this point `start` either points at the first entry with equal or
16
// greater key or is equal to `size` in case all elements have smaller keys
17
- // Invariant: start == size || key_fn(&data[start]) >= *key
18
if start == size || key_fn(&data[start]) != *key {
19
return &[];
20
};
21
- // Invariant: start < size && key_fn(&data[start]) == *key
22
23
// Find the first entry with key > `key`. Skip `start` entries since
24
// key_fn(&data[start]) == *key
25
- // Invariant: offset == size || key_fn(&data[offset]) >= *key
26
let offset = start + 1;
27
let end = data[offset..].partition_point(|x| key_fn(x) <= *key) + offset;
28
- // Invariant: end == size || key_fn(&data[end]) > *key
29
30
&data[start..end]
31
}
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments