3 ms·
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
by gpm 7y ago
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) -> ! {
- steveklabnik 7y agoYes, 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!