diff options
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sync/vec.rs | 16 |
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 + } +} |
