Rollup merge of #89643 - cjgillot:overlap, r=matthewjasper
Fix inherent impl overlap check. The current implementation of the overlap check was slightly buggy, and unified the wrong connected component in the `ids.len() <= 1` case. This became visible in another PR which changed the iteration order of items. r? ``@matthewjasper`` since you reviewed the other PR.
This commit is contained in:
commit
b80dd9e445
3 changed files with 65 additions and 45 deletions
|
@ -738,6 +738,12 @@ impl<I: Idx, T> IndexVec<I, Option<T>> {
|
|||
self.ensure_contains_elem(index, || None);
|
||||
self[index].get_or_insert_with(value)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn remove(&mut self, index: I) -> Option<T> {
|
||||
self.ensure_contains_elem(index, || None);
|
||||
self[index].take()
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: Idx, T: Clone> IndexVec<I, T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue