Skip to content

Commit 620a945

Browse files
committed
fix: handle assert for ensures on spec functions
1 parent 46a8e26 commit 620a945

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

source/vir/src/sst_to_air_func.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::def::{
1010
prefix_fuel_nat, prefix_no_unwind_when, prefix_open_inv, prefix_pre_var, prefix_recursive_fun,
1111
prefix_requires, static_name, suffix_global_id, suffix_typ_param_ids,
1212
};
13-
use crate::messages::{MessageLabel, Span};
13+
use crate::messages::{MessageLabel, Span, internal_error};
1414
use crate::sst::FuncCheckSst;
1515
use crate::sst::{BndX, ExpX, Exps, FunctionSst, ParPurpose, ParX, Pars};
1616
use crate::sst_to_air::{
@@ -698,7 +698,12 @@ pub fn func_decl_to_air(ctx: &mut Ctx, function: &FunctionSst) -> Result<Command
698698
}
699699
}
700700
} else {
701-
assert!(!function.x.has.has_ensures); // no ensures allowed on spec functions yet
701+
if function.x.has.has_ensures {
702+
return Err(crate::messages::error(
703+
&function.x.ret.span,
704+
"no ensures allowed on spec functions yet",
705+
));
706+
}
702707
}
703708

704709
if is_trait_method_impl {

0 commit comments

Comments
 (0)