From 981f4f95f2536841d2746a97274cb29b013ec191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Borgna?= <121866228+aborgna-q@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:35:57 +0200 Subject: [PATCH] fix: Simple replace incorrectly copying metadata (#545) The rewrite was incorrectly using the old node id when updating the metadata in the target hugr. --- src/hugr/rewrite/simple_replace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hugr/rewrite/simple_replace.rs b/src/hugr/rewrite/simple_replace.rs index 00c8f8289..6d127def5 100644 --- a/src/hugr/rewrite/simple_replace.rs +++ b/src/hugr/rewrite/simple_replace.rs @@ -97,7 +97,7 @@ impl Rewrite for SimpleReplacement { // Move the metadata let meta: &NodeMetadata = self.replacement.get_metadata(node); - h.set_metadata(node, meta.clone()).unwrap(); + h.set_metadata(new_node, meta.clone()).unwrap(); } // Add edges between all newly added nodes matching those in replacement. // TODO This will probably change when implicit copies are implemented.