Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename VCError constructors to be more traceable #1311

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading