Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In addition to this excellent reply, if you were using the type core::panic::PanicInfo commonly (i.e. "twice") you would import PanicInfo at the top of the file

    use core::panic::PanicInfo
and the function would become the much shorter

    fn my_panic(_info: PanicInfo) -> ! {


Yes, and you can do something similar with C++ too; I debated if I should include it or not for this reason. (The semantics are a bit different...) Thanks for bringing it up!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: