Skip to content

Commit

Permalink
Better errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Jan 14, 2025
1 parent 6b14b38 commit 185b49f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions executor/src/witgen/jit/witgen_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,12 @@ impl<'a, T: FieldElement, FixedEval: FixedEvaluator<T>> WitgenInference<'a, T, F
// If solve returns an error, it means that the constraint is conflicting.
// In the future, we might run this in a runtime-conditional, so an error
// could just mean that this case cannot happen in practice.
let result = (lhs_evaluated - rhs_evaluated).solve().unwrap();
let result = (lhs_evaluated - rhs_evaluated)
.solve()
.map_err(|e| {
panic!("Error solving equality constraint: {lhs} = {rhs} on row {offset}: {e}");
})
.unwrap();
if result.complete && result.effects.is_empty() {
// A complete result without effects means that there were no unknowns
// in the constraint.
Expand Down Expand Up @@ -258,7 +263,12 @@ impl<'a, T: FieldElement, FixedEval: FixedEvaluator<T>> WitgenInference<'a, T, F
VariableOrValue::Variable(v) => evaluator.evaluate_variable(v.clone()),
VariableOrValue::Value(v) => (*v).into(),
};
(lhs_evaluated - rhs_evaluated).solve().unwrap()
(lhs_evaluated - rhs_evaluated)
.solve()
.map_err(|e| {
panic!("Error solving equality constraint: {lhs} = {rhs} on row {offset}: {e}");
})
.unwrap()
}

fn process_call<CanProcess: CanProcessCall<T>>(
Expand Down Expand Up @@ -568,7 +578,7 @@ struct Assignment<'a, T: FieldElement> {
rhs: VariableOrValue<T, Variable>,
}

#[derive(Clone)]
#[derive(Clone, derive_more::Display)]
enum VariableOrValue<T, V> {
Variable(V),
Value(T),
Expand Down

0 comments on commit 185b49f

Please sign in to comment.