Why does this Rust code cause a stack overflow without recursion or looping?
I cannot figure out why this Rust code causes a stack overflow.
enum SlidingAttackTable {
Rook([[u64; 4096]; 64]),
Bishop([[u64; 512]; 64]),
}
fn init_all() -> (SlidingAttackTable, SlidingAttackTable, [u64; 64], [u64; 64], [usize; 64]) {
return (SlidingAttackTable::Bishop([[0; 512]; 64]), SlidingAttackTable::Rook([[0; 4096]; 64]), [0; 64], [0; 64], [0; 64]);
}
fn main() {
println!("start");
let (bishop_attack_table, rook_attack_table, bishop_masks, bishop_magic_numbers, bishop_relevant_bits) = init_all();
}
I have tried commenting out everything but println!("start")
and it printed "start" with no error. Somehow, when I add just these few lines of code back in, it crashes before even getting to that line and printing "start". There is no looping or recursion going on here that I can detect, so I have no idea how to begin diagnosing this problem.
Comments
Post a Comment