From 5689a747c6acf9f7316b73dbe5ce4a1b3628c60c Mon Sep 17 00:00:00 2001 From: naure Date: Mon, 20 Feb 2023 14:42:35 +0100 Subject: [PATCH] test/unwrap_value: escape Value safety in the dev module (#34) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aurélien Nicolas --- halo2_proofs/src/circuit.rs | 1 + halo2_proofs/src/circuit/value.rs | 7 +++++++ halo2_proofs/src/dev.rs | 2 ++ 3 files changed, 10 insertions(+) diff --git a/halo2_proofs/src/circuit.rs b/halo2_proofs/src/circuit.rs index 254c08ff84..1dc9bd917f 100644 --- a/halo2_proofs/src/circuit.rs +++ b/halo2_proofs/src/circuit.rs @@ -12,6 +12,7 @@ use crate::{ }; mod value; +pub(crate) use value::value_dev; pub use value::Value; pub mod floor_planner; diff --git a/halo2_proofs/src/circuit/value.rs b/halo2_proofs/src/circuit/value.rs index ca31dffda9..1a1bf4f9a2 100644 --- a/halo2_proofs/src/circuit/value.rs +++ b/halo2_proofs/src/circuit/value.rs @@ -701,3 +701,10 @@ impl Value> { } } } + +/// Utilities for tests and dev tools. +pub mod value_dev { + pub fn unwrap_value(v: super::Value) -> T { + v.inner.unwrap() + } +} diff --git a/halo2_proofs/src/dev.rs b/halo2_proofs/src/dev.rs index a020d4c874..cdd1c450b4 100644 --- a/halo2_proofs/src/dev.rs +++ b/halo2_proofs/src/dev.rs @@ -51,6 +51,8 @@ mod graph; #[cfg_attr(docsrs, doc(cfg(feature = "dev-graph")))] pub use graph::{circuit_dot_graph, layout::CircuitLayout}; +pub use crate::circuit::value_dev::unwrap_value; + #[derive(Debug)] struct Region { /// The name of the region. Not required to be unique.