Skip to content

Commit

Permalink
Avoided replacing trigger for any function that returns ()
Browse files Browse the repository at this point in the history
  • Loading branch information
dewert99 committed Oct 20, 2023
1 parent 79db07c commit 5b3e8e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion creusot/src/backend/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rustc_hir::{def::Namespace, def_id::DefId};
use why3::{
declaration::{Contract, Signature},
exp::{Binder, Trigger},
ty::Type,
};

use crate::{
Expand Down Expand Up @@ -65,7 +66,10 @@ pub(crate) fn sig_to_why3<'tcx>(

let retty = names
.with_public_clones(|names| backend::ty::translate_ty(ctx, names, span, pre_sig.output));
let trigger = if ctx.opts.simple_triggers && should_replace_trigger(ctx.tcx, def_id) {
let trigger = if ctx.opts.simple_triggers
&& should_replace_trigger(ctx.tcx, def_id)
&& retty != Type::UNIT
{
None
} else {
Some(Trigger::NONE)
Expand Down

0 comments on commit 5b3e8e3

Please sign in to comment.