Skip to content

aoc_generator(day, part) seems broken #79

@rbtcollins

Description

@rbtcollins
error: custom attribute panicked
 --> src\day1.rs:9:1
  |
9 | #[aoc_generator(day1, pt1_windows2)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: A generator is already defined: Runner { generator: Some(Generator { name: "generate", out_t: "Vec < u32 >", special_type: None }), solver: None }

error: custom attribute panicked
  --> src\day1.rs:22:1
   |
22 | #[aoc(day1, part1_windows2)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: message: runners must have a defined part: "Failed to parse part: part1_windows2"

error: could not compile `aoc-2021` due to 2 previous errors
An error occurs : cargo build failed with code 101
#[aoc_generator(day1)]
fn generate(input: &str) -> Vec<u32> {
    input.lines().flat_map(|s| s.parse()).collect()
}

#[aoc_generator(day1, pt1_windows2)]
fn generate(input: &str) -> Vec<u32> {
    input.lines().flat_map(|s| s.parse()).collect()
}

#[aoc(day1, part1)]
fn solve_part1(input: &[u32]) -> usize {
    input
        .windows(2)
        .filter(|window| window[0] < window[1])
        .count()
}

#[aoc(day1, part1, windows2)]
fn solve_part1_windows2(input: &[u32]) -> usize {
    input
        .windows(2)
        .filter(|window| window[0] < window[1])
        .count()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions