Skip to content

rustc-like error messages for failed proofs #2012

@Kixunil

Description

@Kixunil

I think I know how creusot could get error messages that look completely like rustc and would hugely improve developer experience. I'm also willing to take a shot at it if I get a green light for it, including adding a dependency on an error-message-rendering library. I have an experience with codespan_reporting as I already used it in two projects but recently I found out that rustc uses annotate-snippets which is most likely better choice and I'm totally willing to try to use it. It shouldn't be super hard anyway.

What I imagine is messages like this:

error: cannot prove assertion
 --> src/foo.rs:5:1
  |
5 | proof_assert!(foo@ == bar@);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
  | |
  | |
  | This assertion could not be proven
  |

Or more complex

error: cannot prove precondition `x < 42`
 --> src/foo.rs:7:1
  |
7 | foo(x);
  | ^^^^^^
  | |
  | |
  | The function call with unprovable precondition
  |
note: the precondition was defined here
 --> src/foo.rs:2:3
  |
2 | #[requires(arg < 42)]
  |   ^^^^^^^^^^^^^^^^^^
  |   |
  |   |
  |   This precondition could not be proven
  |

(I'm not sure how hard would it be to substitute the arguments as the example does though. But even if I couldn't do it that would still be way better than the current situation.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions