Detect duplicate labels.

This commit is contained in:
chriseth
2023-04-20 18:39:58 +02:00
parent aeb3fce8e6
commit d14cbc689a

View File

@@ -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.