From b769b01fd06a6a2c66c72f9aa4e1d346b0fca123 Mon Sep 17 00:00:00 2001 From: jfecher Date: Wed, 5 Jun 2024 12:36:48 +0100 Subject: [PATCH] fix: Fix panic in `get_global_let_statement` (#5177) # Description ## Problem\* Resolves ## Summary\* ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/src/node_interner.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index e28a0a64ad0..c223017d752 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -891,8 +891,9 @@ impl NodeInterner { match def { Node::Statement(hir_stmt) => match hir_stmt { HirStatement::Let(let_stmt) => Some(let_stmt.clone()), - _ => { - panic!("ice: all globals should correspond to a let statement in the interner") + HirStatement::Error => None, + other => { + panic!("ice: all globals should correspond to a let statement in the interner: {other:?}") } }, _ => panic!("ice: all globals should correspond to a statement in the interner"),