eure_codegen_ir/structural.rs
1use crate::error::StructuralDiff;
2use crate::module::IrModule;
3
4pub fn structural_eq(lhs: &IrModule, rhs: &IrModule) -> bool {
5 lhs == rhs
6}
7
8pub fn assert_structural_eq(lhs: &IrModule, rhs: &IrModule) -> Result<(), StructuralDiff> {
9 if lhs == rhs {
10 Ok(())
11 } else {
12 Err(StructuralDiff::new(
13 "module",
14 format!(
15 "structural modules differ\nleft={:#?}\nright={:#?}",
16 lhs, rhs
17 ),
18 ))
19 }
20}