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