Here is the code:
pub struct Node<T> {
data: Option<T>,
level: usize,
forward: [Option<*mut Node<T>>; MAX_HEIGHT],
}
And I want to iterate the linked list:
// let next = some_node.forward[n];
unsafe {
loop {
match next {
None => { break; }
Some(v) => {
write!(f, "{:?}", (*v).data)?;
break;
}
}
}
}
When I use unsafe
keyword, I get the [1] 74042 illegal hardware instruction cargo run
error, so is there anyway to debug this unsafe
block?