Skip to content

Commit

Permalink
test/unwrap_value: escape Value safety in the dev module (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Aurélien Nicolas <info@nau.re>
  • Loading branch information
naure and Aurélien Nicolas committed Feb 20, 2023
1 parent d292643 commit 5689a74
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions halo2_proofs/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
};

mod value;
pub(crate) use value::value_dev;
pub use value::Value;

pub mod floor_planner;
Expand Down
7 changes: 7 additions & 0 deletions halo2_proofs/src/circuit/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,3 +701,10 @@ impl<F: Field> Value<Assigned<F>> {
}
}
}

/// Utilities for tests and dev tools.
pub mod value_dev {
pub fn unwrap_value<T>(v: super::Value<T>) -> T {
v.inner.unwrap()
}
}
2 changes: 2 additions & 0 deletions halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5689a74

Please sign in to comment.