From 55f456da1425c91991c1bb0e92ea9f9927da3302 Mon Sep 17 00:00:00 2001
From: nilfit <nils.fitinghoff@gmail.com>
Date: Wed, 31 Jan 2018 17:50:38 +0100
Subject: [PATCH] allow execution to continue after hitting errors

The consumer can now choose to allow execution to continue without
getting stuck.
---
 src/bin/seer.rs | 6 ++----
 src/executor.rs | 7 ++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/bin/seer.rs b/src/bin/seer.rs
index dd5668e..2f1fa3e 100644
--- a/src/bin/seer.rs
+++ b/src/bin/seer.rs
@@ -71,11 +71,9 @@ fn main() {
         println!("{:?}", complete);
         println!("as string: {:?}", ::std::str::from_utf8(&complete.input));
         if let Err(_) = complete.result {
-            println!("hit an error. halting");
-            false
-        } else {
-            true
+            println!("hit an error. continuing");
         }
+        true
     };
 
     let mut config = ::seer::ExecutionConfig::new();
diff --git a/src/executor.rs b/src/executor.rs
index e0da30b..4fc794f 100644
--- a/src/executor.rs
+++ b/src/executor.rs
@@ -154,6 +154,7 @@ impl <'a, 'tcx: 'a> Executor<'a, 'tcx> {
                         let iter = ::std::iter::repeat(ecx).zip(branches.into_iter());
                         for (mut cx, finish_step) in iter {
                             let FinishStep {constraints, variant} = finish_step;
+                            let mut no_errors: bool = true;
                             for constraint in constraints {
                                 cx.memory.constraints.push_constraint(constraint);
                                 match variant {
@@ -169,10 +170,14 @@ impl <'a, 'tcx: 'a> Executor<'a, 'tcx> {
                                         if !self.report_error(&cx, e.clone()) {
                                             break 'main_loop;
                                         }
+                                        no_errors = false;
                                     }
                                 }
                             }
-                            self.push_eval_context(cx);
+                            if no_errors {
+                                // only continue along branches without errors
+                                self.push_eval_context(cx);
+                            }
                         }
                     }
                 }
-- 
GitLab