From 7edd1d8799aff9d4dfea72e37c500ec8fdb0afb8 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 14 Mar 2023 12:16:19 +0000 Subject: Replace another lock with an append-only vec --- compiler/rustc_data_structures/src/sync/vec.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'compiler/rustc_data_structures/src/sync') 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 AppendOnlyVec { return self.vec.get(i); } } + +impl AppendOnlyVec { + 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 + } +} -- cgit 1.4.1-3-g733a5