Skip to content

Commit 0a2fa77

Browse files
coord-eclaude
andcommitted
fixup! Enable to annotate functions with formula_fn
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3c749df commit 0a2fa77

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

src/analyze.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -591,28 +591,32 @@ impl<'tcx> Analyzer<'tcx> {
591591
continue;
592592
}
593593
let rustc_hir::StmtKind::Semi(expr) = stmt.kind else {
594-
panic!(
595-
"annotated path is expected to be a semi statement, but found: {:?}",
596-
stmt.kind
594+
self.tcx.dcx().span_err(
595+
stmt.span,
596+
"annotated path is expected to be a semi statement",
597597
);
598+
continue;
598599
};
599600
let rustc_hir::ExprKind::Path(qpath) = expr.kind else {
600-
panic!(
601-
"annotated path is expected to be a path expression, but found: {:?}",
602-
expr.kind
601+
self.tcx.dcx().span_err(
602+
expr.span,
603+
"annotated path is expected to be a path expression",
603604
);
605+
continue;
604606
};
605607
let rustc_hir::QPath::Resolved(_, path) = qpath else {
606-
panic!(
607-
"qpath is unexpectedly not resolved in annotated path: {:?}",
608-
qpath
608+
self.tcx.dcx().span_err(
609+
expr.span,
610+
"annotated path is expected to be a resolved path",
609611
);
612+
continue;
610613
};
611614
let rustc_hir::def::Res::Def(_, def_id) = path.res else {
612-
panic!(
613-
"annotated path is expected to refer to a def, but found: {:?}",
614-
path.res
615+
self.tcx.dcx().span_err(
616+
path.span,
617+
"annotated path is expected to refer to a definition",
615618
);
619+
continue;
616620
};
617621
return Some(def_id);
618622
}

0 commit comments

Comments
 (0)