Rework dependency-tracking to be poison-free

Now new dependency edges that introduce cycles are simply rejected, not
affecting the overall graph. This simplifies the visible API and also
removes the need to restore the graph.
This commit is contained in:
2021-05-16 14:16:51 +02:00
parent 440693ab1e
commit 50e99fd07a
4 changed files with 42 additions and 134 deletions

View File

@@ -380,12 +380,9 @@ mod tests {
use std::thread;
use super::*;
use crate::tests::GRAPH_MUTEX;
#[test]
fn test_mutex_usage() {
let _graph_lock = GRAPH_MUTEX.lock();
let mutex = Arc::new(TracingMutex::new(()));
let mutex_clone = mutex.clone();
@@ -403,8 +400,6 @@ mod tests {
#[test]
fn test_rwlock_usage() {
let _graph_lock = GRAPH_MUTEX.lock();
let rwlock = Arc::new(TracingRwLock::new(()));
let rwlock_clone = rwlock.clone();
@@ -425,8 +420,6 @@ mod tests {
#[test]
fn test_once_usage() {
let _graph_lock = GRAPH_MUTEX.lock();
let once = Arc::new(TracingOnce::new());
let once_clone = once.clone();
@@ -448,8 +441,6 @@ mod tests {
#[test]
#[should_panic(expected = "Mutex order graph should not have cycles")]
fn test_detect_cycle() {
let _graph_lock = GRAPH_MUTEX.lock();
let a = TracingMutex::new(());
let b = TracingMutex::new(());