#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop{}
}
#[no_mangle]
pub extern "C" fn _start() -> ! {
let mut x: i32 = 3;
loop{
x = x + 1;
}
}
Hi all,
As I start with RUST on risc-v, I am able to compile above and run in my target. Can someone help me on how to get rid of the panic handler? I am new to rust & it seems RUST enforces a panic handler I may be wrong. so in RUST is panic hanlder mandatory? if not, what changes would help me to get rid of the panic handler?
Thanks, but i want to build my code WITHOUT any library. Hence, is there a way to get away this panic handler inturn get away with the core library? Is it possible? or its mandatory to have panic handler in RUST?
In this case you can use #![no_core] in addition to #![no_std]. Not sure if this is what you want, however, since in this case you'll have to provide literally every reference to the used compiler intrinsics.
It's mandatory even for no_core, yes, since there are some operations which has the implicit panic semantics.