From a6e8ac06b67d48e5fe4274a1f136c7d7733cc09d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 29 Jul 2022 19:13:23 +0200 Subject: [PATCH] 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. --- src/movegen/magic/mod.rs | 43 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/movegen/magic/mod.rs b/src/movegen/magic/mod.rs index 8b3f605..7609199 100644 --- a/src/movegen/magic/mod.rs +++ b/src/movegen/magic/mod.rs @@ -22,5 +22,46 @@ impl Magic { #[cfg(generated_boards)] mod moves; -#[cfg(generated_boards)] 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!() + } +}