diff options
| author | bors <bors@rust-lang.org> | 2024-07-04 06:18:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-04 06:18:55 +0000 |
| commit | 486bc278ab4cf516ccc176cee4a268e104b6e69c (patch) | |
| tree | a11da76995e57fe1ea2809ae5684fcb08927089b /compiler/rustc_index/src/vec.rs | |
| parent | f6fa358a182b2f8e4d5a10faac4dae950493c9bc (diff) | |
| parent | a9194f30eb5b80bd659f3f8e8357fd19b771063e (diff) | |
| download | rust-486bc278ab4cf516ccc176cee4a268e104b6e69c.tar.gz rust-486bc278ab4cf516ccc176cee4a268e104b6e69c.zip | |
Auto merge of #127293 - ldm0:ldm_coroutine, r=saethlin
Use `IndexVec` for coroutine local mapping Resolves a old FIXME
Diffstat (limited to 'compiler/rustc_index/src/vec.rs')
| -rw-r--r-- | compiler/rustc_index/src/vec.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 88298150a79..b866c8b8433 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -208,6 +208,11 @@ impl<I: Idx, T> IndexVec<I, Option<T>> { pub fn remove(&mut self, index: I) -> Option<T> { self.get_mut(index)?.take() } + + #[inline] + pub fn contains(&self, index: I) -> bool { + self.get(index).and_then(Option::as_ref).is_some() + } } impl<I: Idx, T: fmt::Debug> fmt::Debug for IndexVec<I, T> { |
