From f929c27ff12f5f64d96f1585d945f9fa4586d182 Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Wed, 13 May 2026 09:31:11 +0100 Subject: [PATCH] Assert when Rust side of rule is missing --- cpp2rust/converter/translation_rule.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp2rust/converter/translation_rule.cpp b/cpp2rust/converter/translation_rule.cpp index c76520ce..1d6a757a 100644 --- a/cpp2rust/converter/translation_rule.cpp +++ b/cpp2rust/converter/translation_rule.cpp @@ -189,14 +189,18 @@ void LoadIrSrc(ExprRules &exprs, TypeRules &types, auto val = entry_val.getAsString(); if (name[0] == 'f') { auto it = exprs.find(name); - if (it != exprs.end()) { - it->second.src = val->str(); + if (it == exprs.end()) { + llvm::errs() << name << '\n'; + assert(0 && "ir_src.json expr entry has no matching IR target rule"); } + it->second.src = val->str(); } else if (name[0] == 't') { auto it = types.find(name); - if (it != types.end()) { - it->second.src = val->str(); + if (it == types.end()) { + llvm::errs() << name << '\n'; + assert(0 && "ir_src.json type entry has no matching IR target rule"); } + it->second.src = val->str(); } } }