I am writing for embedded, no_std
environment and trying to make sure the code is not panicking in any circumstances. For this I “hacked” the linker script to discard sections that would contain the panicking code as in:
/DISCARD/ :
{
*(.text.*panic_fmt*)
}
So with this the linker will fail every time there is some code that might panic.
Now, I have found that the following code might panic:
let mut hash: [u8; 64] = [0; 64];
.....
for b in hash {
// Do something with b
}
as the linker is failing and is telling me that panic_fmt
is referenced from core::slice::index::slice_start_index_len_fail_rt
.
Is there a way to have a non-panicking iteration without much hacking?