gobanos/cargo-aoc

cargo aoc fails to compile solution

Closed this issue · 2 comments

I have set up my project acording to this
and when I try to run my code I get this error

error: custom attribute panicked
 --> src/day1.rs:1:1
  |
1 | #[aoc(day1, part1)]
  | ^^^^^^^^^^^^^^^^^^^
  |
  = help: message: failed to borrow shared map from runner: AlreadyConsumed

error: could not compile `aoc_2023` (lib) due to previous error
An error occurs : cargo build failed with code 101

lib.rs:

extern crate aoc_runner;

#[macro_use]
extern crate aoc_runner_derive;

aoc_lib! {year = 2023}

pub mod day1.rs;

day1.rs:

#[aoc(day1, part1)]
pub fn day1(input: &[u8]) -> usize {
    0
}

Cargo.toml: (only relevant parts)

[package]
edition = "2021"

[dependencies]
aoc-runner = "0.3.0"
aoc-runner-derive = "0.3.0"

Cargo aoc relies on a hack in order to get all informations required.
Your mod declaration should be before aoc_lib! {year = 2023} in order for it to work properly.

thank you for the solution