Skip to content

Commit d117eb8

Browse files
committed
Convert PUZZLES slice from const to static
Speeds up a clean build by ~10% on my system by moving codegen to the aoc library crate, which can begin as soon as the frontend is complete for all year crates. Previously, codegen occurred when compiling the binary aoc crate, after both the frontend and codegen had finished for all year crates, lengthening the critical path.
1 parent d66e227 commit d117eb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/aoc/src/puzzles.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ macro_rules! matcher {
2020
$d:literal => $day:ident,
2121
)*}
2222
)*) => {
23-
/// Constant containing each puzzle solution.
23+
/// Slice containing all supported puzzle solutions.
2424
///
2525
/// Each puzzle is represented by a tuple of [`Year`], [`Day`] and [`PuzzleFn`], which takes
2626
/// a input string and returns the part 1 and 2 solutions as strings, or an [`InputError`].
2727
///
2828
/// Generated from [`all_puzzles!`].
29-
pub const PUZZLES: &[(Year, Day, PuzzleFn)] = &[$($(
29+
pub static PUZZLES: &[(Year, Day, PuzzleFn)] = &[$($(
3030
(crate::$year::$day::YEAR, crate::$year::$day::DAY, |input: &str| {
3131
let input = strip_final_newline(input);
3232
let solution = crate::$year::$day::new(input, InputType::Real)?;

0 commit comments

Comments
 (0)