From c4834026cf5dc12d17847384358a65553d951bb1 Mon Sep 17 00:00:00 2001 From: edgarr1986 Date: Mon, 30 Mar 2026 13:40:18 +0800 Subject: [PATCH] fix(forge-lint): avoid panic on missing AST/HIR sources --- crates/lint/src/sol/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/lint/src/sol/mod.rs b/crates/lint/src/sol/mod.rs index f9afac2b00443..295434faca99a 100644 --- a/crates/lint/src/sol/mod.rs +++ b/crates/lint/src/sol/mod.rs @@ -275,7 +275,8 @@ impl<'a> Linter for SolidityLinter<'a> { return; }; let Some(ast) = &ast_source.ast else { - panic!("AST missing for {}", path.display()); + _ = sh_warn!("AST missing for {}", path.display()); + return; }; // Parse inline config. @@ -288,7 +289,8 @@ impl<'a> Linter for SolidityLinter<'a> { // Late lints. let Some((hir_source_id, _)) = gcx.get_hir_source(path) else { - panic!("HIR source not found for {}", path.display()); + _ = sh_warn!("HIR source not found for {}", path.display()); + return; }; let _ = self.process_source_hir(gcx, hir_source_id, path, &inline_config); });