about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/sync/vec.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-03-14 12:16:19 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-04-04 09:01:44 +0000
commit7edd1d8799aff9d4dfea72e37c500ec8fdb0afb8 (patch)
tree68afca411d2e137474785cfc7e792d4086f22d1e /compiler/rustc_data_structures/src/sync/vec.rs
parent46996326377b100fa461b49b5be0c91a075f55e5 (diff)
downloadrust-7edd1d8799aff9d4dfea72e37c500ec8fdb0afb8.tar.gz
rust-7edd1d8799aff9d4dfea72e37c500ec8fdb0afb8.zip
Replace another lock with an append-only vec
Diffstat (limited to 'compiler/rustc_data_structures/src/sync/vec.rs')
-rw-r--r--compiler/rustc_data_structures/src/sync/vec.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/sync/vec.rs b/compiler/rustc_data_structures/src/sync/vec.rs
index 99de33685f6..64b0aff6ca2 100644
--- a/compiler/rustc_data_structures/src/sync/vec.rs
+++ b/compiler/rustc_data_structures/src/sync/vec.rs
@@ -76,3 +76,19 @@ impl<T: Copy> AppendOnlyVec<T> {
         return self.vec.get(i);
     }
 }
+
+impl<T: Copy + PartialEq> AppendOnlyVec<T> {
+    pub fn contains(&self, val: T) -> bool {
+        for i in 0.. {
+            match self.get(i) {
+                None => return false,
+                Some(v) => {
+                    if val == v {
+                        return true;
+                    }
+                }
+            }
+        }
+        false
+    }
+}