Skip to content

Commit 22386ae

Browse files
committed
fix
1 parent 5b9e738 commit 22386ae

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

circuit/src/builder/circuit_builder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@ where
117117
}
118118

119119
/// Allocates a witness hint (uninitialized witness slot set during non-primitive execution).
120+
#[must_use]
120121
pub fn alloc_witness_hint(&mut self, label: &'static str) -> ExprId {
121122
self.expr_builder.add_witness_hint(label)
122123
}
123124

124125
/// Allocates multiple witness hints.
126+
#[must_use]
125127
pub fn alloc_witness_hints(&mut self, count: usize, label: &'static str) -> Vec<ExprId> {
126128
self.expr_builder.add_witness_hints(count, label)
127129
}
@@ -245,9 +247,6 @@ where
245247
}
246248

247249
/// Pushes a non-primitive op. Returns op id.
248-
// TODO: The lowerer needs to map the hinted `ExprId`s to `WitnessId`s, hence
249-
// the provided `witness_exprs` must contain the generated outputs.
250-
// Would maybe need to change that.
251250
#[allow(unused_variables)]
252251
pub(crate) fn push_non_primitive_op(
253252
&mut self,

circuit/src/builder/compiler/expression_lowerer.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,6 @@ where
270270
// The output of Div is the b_widx.
271271
expr_to_widx.insert(expr_id, b_widx);
272272
}
273-
Expr::NonPrimitiveOp { .. } => {
274-
// Skip non-primitive operations
275-
}
276273
}
277274
}
278275

circuit/src/builder/expression_builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ where
101101
/// Adds a witness hint to the graph.
102102
/// It will allocate a `WitnessId` during lowering, with no primitive op.
103103
#[allow(unused_variables)]
104+
#[must_use]
104105
pub fn add_witness_hint(&mut self, label: &'static str) -> ExprId {
105106
let expr_id = self.graph.add_expr(Expr::Witness);
106107

@@ -117,6 +118,7 @@ where
117118
}
118119

119120
/// Adds multiple witness hints.
121+
#[must_use]
120122
pub fn add_witness_hints(&mut self, count: usize, label: &'static str) -> Vec<ExprId> {
121123
(0..count).map(|_| self.add_witness_hint(label)).collect()
122124
}

circuit/src/expr.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use alloc::vec::Vec;
22

3-
use crate::NonPrimitiveOpType;
43
use crate::types::ExprId;
54

65
/// Expression DAG for field operations
@@ -21,13 +20,6 @@ pub enum Expr<F> {
2120
Mul { lhs: ExprId, rhs: ExprId },
2221
/// Division of two expressions
2322
Div { lhs: ExprId, rhs: ExprId },
24-
25-
/// Non-primitive operation
26-
NonPrimitiveOp {
27-
inputs: Vec<ExprId>,
28-
outputs: Vec<ExprId>,
29-
op: NonPrimitiveOpType,
30-
},
3123
}
3224

3325
/// Graph for storing expression DAG nodes

circuit/src/tables/runner.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use alloc::string::ToString;
12
use alloc::vec::Vec;
23
use alloc::{format, vec};
34

@@ -87,25 +88,24 @@ impl<F: CircuitField> CircuitRunner<F> {
8788
return Err(CircuitError::IncorrectNonPrimitiveOpPrivateData {
8889
op: op_ty.clone(),
8990
operation_index: op_id,
90-
expected: format!("no private data"),
91-
got: format!("{private_data:?}"),
91+
expected: "no private data".to_string(),
92+
got: alloc::format!("{private_data:?}"),
9293
});
9394
}
9495
}
9596
}
9697

9798
// Disallow double-setting private data
98-
if self.non_primitive_op_private_data[op_id.0 as usize].is_some() {
99-
if let Op::NonPrimitiveOpWithExecutor { executor, .. } =
99+
if self.non_primitive_op_private_data[op_id.0 as usize].is_some()
100+
&& let Op::NonPrimitiveOpWithExecutor { executor, .. } =
100101
&self.circuit.non_primitive_ops[op_id.0 as usize]
101-
{
102-
return Err(CircuitError::IncorrectNonPrimitiveOpPrivateData {
103-
op: executor.op_type().clone(),
104-
operation_index: op_id,
105-
expected: format!("private data not previously set"),
106-
got: format!("already set"),
107-
});
108-
}
102+
{
103+
return Err(CircuitError::IncorrectNonPrimitiveOpPrivateData {
104+
op: executor.op_type().clone(),
105+
operation_index: op_id,
106+
expected: "private data not previously set".to_string(),
107+
got: "already set".to_string(),
108+
});
109109
}
110110

111111
// Store private data for this operation

0 commit comments

Comments
 (0)