Add dummy 'magic::moves' module for build script

Since I'm am doing something quite *weird*, by writing a build script
that makes use of the module I am generating code for, I need to ensure
that it compiles both without the generated code, and with it.

So this dummy implementation of the module ensures that the code will
keep compiling in both cases, and panics if any of the functions that
depend on generated code are called during the build script execution.
This commit is contained in:
Bruno BELANYI 2022-07-29 19:13:23 +02:00
parent 99129e453c
commit a6e8ac06b6

View file

@ -22,5 +22,46 @@ impl Magic {
#[cfg(generated_boards)] #[cfg(generated_boards)]
mod moves; mod moves;
#[cfg(generated_boards)]
pub use moves::*; pub use moves::*;
#[cfg(not(generated_boards))]
#[allow(unused_variables)]
mod moves {
use crate::board::{Bitboard, Color, Square};
pub fn quiet_pawn_moves(color: Color, square: Square, blockers: Bitboard) -> Bitboard {
unreachable!()
}
pub fn pawn_moves(color: Color, square: Square, blockers: Bitboard) -> Bitboard {
unreachable!()
}
pub fn knight_moves(square: Square) -> Bitboard {
unreachable!()
}
pub fn bishop_moves(square: Square, blockers: Bitboard) -> Bitboard {
unreachable!()
}
pub fn rook_moves(square: Square, blockers: Bitboard) -> Bitboard {
unreachable!()
}
pub fn queen_moves(square: Square, blockers: Bitboard) -> Bitboard {
unreachable!()
}
pub fn king_moves(square: Square) -> Bitboard {
unreachable!()
}
pub fn king_side_castle_blockers(color: Color) -> Bitboard {
unreachable!()
}
pub fn queen_side_castle_blockers(color: Color) -> Bitboard {
unreachable!()
}
}