feat(library/vm/vm): improve vm check error message

This commit is contained in:
Gabriel Ebner 2017-02-15 17:59:04 +01:00 committed by Leonardo de Moura
parent 93d00534e0
commit cbebedb53b
2 changed files with 5 additions and 4 deletions

View file

@ -3505,8 +3505,9 @@ environment load_external_fn(environment & env, name const & extern_n) {
}
}
[[noreturn]] void vm_check_failed(char const *fn, unsigned line, char const *msg) {
throw exception(sstream() << "VM check failed at " << fn << ":" << line << ": " << msg);
[[noreturn]] void vm_check_failed(char const * condition) {
throw exception(sstream() << "vm check failed: " << condition
<< " (possibly due to incorrect axioms, or sorry)");
}
class vm_index_manager {

View file

@ -58,11 +58,11 @@ public:
#define LEAN_ALWAYS_INLINE
#endif
[[noreturn]] void vm_check_failed(char const * fn, unsigned line, char const * msg);
[[noreturn]] void vm_check_failed(char const * condition);
#if defined(LEAN_VM_UNCHECKED)
#define lean_vm_check(cond) lean_assert(cond)
#else
#define lean_vm_check(cond) { if (LEAN_UNLIKELY(!(cond))) vm_check_failed(__FILE__, __LINE__, #cond); }
#define lean_vm_check(cond) { if (LEAN_UNLIKELY(!(cond))) vm_check_failed(#cond); }
#endif
void display(std::ostream & out, vm_obj const & o);