mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Eliminate Stmt::RuntimeError in favor of crash
This commit is contained in:
parent
a2f2a18a76
commit
803d7e30e3
14 changed files with 115 additions and 130 deletions
|
@ -1,5 +1,6 @@
|
|||
use core::ffi::c_void;
|
||||
|
||||
use roc_mono::ir::CrashTag;
|
||||
use roc_std::RocStr;
|
||||
|
||||
/// # Safety
|
||||
|
@ -39,14 +40,12 @@ pub unsafe fn roc_dealloc(c_ptr: *mut c_void, _alignment: u32) {
|
|||
/// The Roc application needs this.
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_panic(msg: &RocStr, tag_id: u32) {
|
||||
use roc_gen_llvm::llvm::build::PanicTagId;
|
||||
|
||||
match PanicTagId::try_from(tag_id) {
|
||||
Ok(PanicTagId::RocPanic) => {
|
||||
match CrashTag::try_from(tag_id) {
|
||||
Ok(CrashTag::Roc) => {
|
||||
eprintln!("Roc hit a panic: {}", msg);
|
||||
std::process::exit(1);
|
||||
}
|
||||
Ok(PanicTagId::UserPanic) => {
|
||||
Ok(CrashTag::User) => {
|
||||
eprintln!("User panic: {}", msg);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue