From d14cbc689a8494cff8de0dd908c556dc120ef3b3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 20 Apr 2023 18:39:58 +0200 Subject: [PATCH] Detect duplicate labels. --- src/asm_compiler/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/asm_compiler/mod.rs b/src/asm_compiler/mod.rs index 5f3e4e498..e0550cbb3 100644 --- a/src/asm_compiler/mod.rs +++ b/src/asm_compiler/mod.rs @@ -649,8 +649,11 @@ impl ASMPILConverter { self.code_lines .iter() .enumerate() - .filter_map(|(i, line)| line.label.as_ref().map(|l| (l.clone(), i))) - .collect() + .filter_map(|(i, line)| line.label.as_ref().map(|l| (l, i))) + .fold(HashMap::new(), |mut r, (l, i)| { + assert!(r.insert(l.clone(), i).is_none(), "Duplicate label: {l}"); + r + }) } /// Creates a pair of witness and fixed column and matches them in the lookup.