diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-11 23:45:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-11 23:45:46 +0200 |
| commit | b80dd9e445e19fd82d305cd61cd266b0ee61bfee (patch) | |
| tree | 8184e398e99338e18bd47314f05b6105aadf8cc1 /compiler/rustc_index/src | |
| parent | 412301b26a8a6edb4cdba2bebb430f5b34e728ac (diff) | |
| parent | a3f98a7501384d4cd11ba94a46bdf88b7e2bc816 (diff) | |
| download | rust-b80dd9e445e19fd82d305cd61cd266b0ee61bfee.tar.gz rust-b80dd9e445e19fd82d305cd61cd266b0ee61bfee.zip | |
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.
Diffstat (limited to 'compiler/rustc_index/src')
| -rw-r--r-- | compiler/rustc_index/src/vec.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index e9efa2f255d..69578e85f27 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -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> { |
