rust/src/trap.rs

14 lines
297 B
Rust
Raw Normal View History

2018-11-16 10:35:47 -06:00
use cranelift::prelude::*;
2018-11-24 05:47:53 -06:00
2018-11-16 10:35:47 -06:00
use cranelift::codegen::ir::TrapCode;
/// Trap code: user0
pub fn trap_panic(bcx: &mut FunctionBuilder) {
bcx.ins().trap(TrapCode::User(0));
}
/// Trap code: user65535
pub fn trap_unreachable(bcx: &mut FunctionBuilder) {
bcx.ins().trap(TrapCode::User(!0));
}