about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/transitive_relation
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-03-17 10:28:52 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-03-17 10:31:30 -0400
commit620ecc01a2eb28848f5f3d8039bdb1f23d8cc21f (patch)
treee20ad511734f529cc8dfafd1e009db4ced925a86 /compiler/rustc_data_structures/src/transitive_relation
parent5c6d3bf3896b465e15550f49c2861e3d18102270 (diff)
downloadrust-620ecc01a2eb28848f5f3d8039bdb1f23d8cc21f.tar.gz
rust-620ecc01a2eb28848f5f3d8039bdb1f23d8cc21f.zip
Move some test-only code to test files
This also relaxes the bounds on some structs and moves them to the impl
block instead.
Diffstat (limited to 'compiler/rustc_data_structures/src/transitive_relation')
-rw-r--r--compiler/rustc_data_structures/src/transitive_relation/tests.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/transitive_relation/tests.rs b/compiler/rustc_data_structures/src/transitive_relation/tests.rs
index ca90ba176ae..9fa7224376c 100644
--- a/compiler/rustc_data_structures/src/transitive_relation/tests.rs
+++ b/compiler/rustc_data_structures/src/transitive_relation/tests.rs
@@ -1,5 +1,13 @@
 use super::*;
 
+impl<T: Eq + Hash> TransitiveRelation<T> {
+    /// A "best" parent in some sense. See `parents` and
+    /// `postdom_upper_bound` for more details.
+    fn postdom_parent(&self, a: &T) -> Option<&T> {
+        self.mutual_immediate_postdominator(self.parents(a))
+    }
+}
+
 #[test]
 fn test_one_step() {
     let mut relation = TransitiveRelation::default();