From 521314e59e6b3e6a90190d8405b9fcbb629f580e Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Tue, 19 Mar 2024 09:02:47 +0000 Subject: [PATCH] Any clearer? --- quantinuum-hugr/src/extension/infer/test.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/quantinuum-hugr/src/extension/infer/test.rs b/quantinuum-hugr/src/extension/infer/test.rs index 2d1c6afc2..25f28bda7 100644 --- a/quantinuum-hugr/src/extension/infer/test.rs +++ b/quantinuum-hugr/src/extension/infer/test.rs @@ -797,18 +797,20 @@ fn test_cfg_loops() -> Result<(), Box> { #[test] #[cfg(feature = "extension_inference")] fn test_validate_with_closure() -> Result<(), Box> { - let hugr = make_looping_cfg( + let mut hugr = make_looping_cfg( ExtensionSet::new(), ExtensionSet::singleton(&A), ExtensionSet::singleton(&B), )?; - let soln = infer_extensions(&hugr)?; - hugr.validate_with_extension_closure(soln, &PRELUDE_REGISTRY)?; - let mut hugr = hugr.clone(); assert_matches!( hugr.validate(&PRELUDE_REGISTRY), Err(ValidationError::ExtensionError(_)) ); + + let immut = hugr.clone(); + let soln = infer_extensions(&immut)?; + immut.validate_with_extension_closure(soln, &PRELUDE_REGISTRY)?; + hugr.update_validate(&PRELUDE_REGISTRY)?; // Solution written in, hence: hugr.validate(&PRELUDE_REGISTRY)?; Ok(())