Skip to content

Commit

Permalink
Rename VCError constructors to be more traceable (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysxia authored Dec 30, 2024
2 parents c373377 + 57fe9f5 commit 18c9ca1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion creusot/src/backend/logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub(crate) fn translate_logic_or_predicate(

let body = match body {
Ok(body) => body,
Err(e) => ctx.fatal_error(e.span(), &format!("{e:?}")).emit(),
Err(e) => ctx.fatal_error(e.span(), &format!("translate_logic_or_predicate: {e:?}")).emit(),
};

let requires = sig.contract.requires.into_iter().map(Condition::unlabelled_exp);
Expand Down
18 changes: 9 additions & 9 deletions creusot/src/backend/logic/vcgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ fn is_structurally_recursive(ctx: &mut Why3Generator<'_>, self_id: DefId, t: &Te
#[derive(Debug)]
pub enum VCError<'tcx> {
/// `old` doesn't currently make sense inside of a lemma function
Old(Span),
OldInLemma(Span),
/// Too lazy to implement this atm.
Reborrow(Span),
UnimplementedReborrow(Span),
/// Same here...
Closure(Span),
UnimplementedClosure(Span),
/// Variants are currently restricted to `Int`
#[allow(dead_code)] // this lint is too agressive
UnsupportedVariant(Ty<'tcx>, Span),
Expand All @@ -197,9 +197,9 @@ pub enum VCError<'tcx> {
impl<'tcx> VCError<'tcx> {
pub fn span(&self) -> Span {
match self {
VCError::Old(s) => *s,
VCError::Reborrow(s) => *s,
VCError::Closure(s) => *s,
VCError::OldInLemma(s) => *s,
VCError::UnimplementedReborrow(s) => *s,
VCError::UnimplementedClosure(s) => *s,
VCError::UnsupportedVariant(_, s) => *s,
}
}
Expand Down Expand Up @@ -432,9 +432,9 @@ impl<'a, 'tcx> VCGen<'a, 'tcx> {

self.build_vc(lhs, &|lhs| k(lhs.field(&field)))
}
TermKind::Old { .. } => Err(VCError::Old(t.span)),
TermKind::Closure { .. } => Err(VCError::Closure(t.span)),
TermKind::Reborrow { .. } => Err(VCError::Reborrow(t.span)),
TermKind::Old { .. } => Err(VCError::OldInLemma(t.span)),
TermKind::Closure { .. } => Err(VCError::UnimplementedClosure(t.span)),
TermKind::Reborrow { .. } => Err(VCError::UnimplementedReborrow(t.span)),
}
}

Expand Down

0 comments on commit 18c9ca1

Please sign in to comment.