Skip to content

Commit cbeacfa

Browse files
coord-eclaude
andcommitted
fixup! Translate and register formula_fn
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fda3d96 commit cbeacfa

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/analyze/annot_fn.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,16 @@ impl<'tcx> AnnotFnTranslator<'tcx> {
312312
},
313313
ExprKind::Lit(lit) => match lit.node {
314314
rustc_ast::LitKind::Int(i, _) => {
315-
let t = chc::Term::int(i.get() as i64);
316-
FormulaOrTerm::Term(t)
315+
let n = i64::try_from(i.get())
316+
.expect("integer literal out of i64 range in formula");
317+
FormulaOrTerm::Term(chc::Term::int(n))
317318
}
318319
rustc_ast::LitKind::Bool(b) => FormulaOrTerm::Literal(b),
319320
_ => unimplemented!("unsupported literal in formula: {:?}", lit),
320321
},
321322
ExprKind::Path(qpath) => {
322323
if let rustc_hir::def::Res::Local(hir_id) =
323-
self.typeck.qpath_res(&qpath, self.body.value.hir_id)
324+
self.typeck.qpath_res(&qpath, hir.hir_id)
324325
{
325326
FormulaOrTerm::Term(
326327
self.env
@@ -355,6 +356,11 @@ impl<'tcx> AnnotFnTranslator<'tcx> {
355356
let t2 = self.to_term(&args[1]);
356357
return FormulaOrTerm::Term(chc::Term::mut_(t1, t2));
357358
}
359+
if Some(def_id) == self.def_ids.box_model_new() {
360+
assert_eq!(args.len(), 1, "Box::new takes exactly 1 argument");
361+
let t = self.to_term(&args[0]);
362+
return FormulaOrTerm::Term(chc::Term::box_(t));
363+
}
358364
}
359365
}
360366
unimplemented!("unsupported call in formula: {:?}", func_expr)

0 commit comments

Comments
 (0)