]> git.lizzy.rs Git - rust.git/commitdiff
Add a `contains` method to `ResultsCursor`
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Mon, 20 Jan 2020 23:03:37 +0000 (15:03 -0800)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Mon, 10 Feb 2020 21:03:08 +0000 (13:03 -0800)
src/librustc_mir/dataflow/generic/cursor.rs

index d2eff494ad701b4b963d64288c9bbe46f91603bf..8c0ab1505284a0d5014e98ad7674bc1bfd10a1b1 100644 (file)
@@ -65,6 +65,13 @@ pub fn get(&self) -> &BitSet<A::Idx> {
         &self.state
     }
 
+    /// Returns `true` if the dataflow state at the current location contains the given element.
+    ///
+    /// Shorthand for `self.get().contains(elem)`
+    pub fn contains(&self, elem: A::Idx) -> bool {
+        self.state.contains(elem)
+    }
+
     /// Resets the cursor to the start of the given basic block.
     pub fn seek_to_block_start(&mut self, block: BasicBlock) {
         self.state.overwrite(&self.results.borrow().entry_sets[block]);