cargo-aoc
cargo-aoc copied to clipboard
Lifetime error with `#[aoc...`
I'm just getting off the ground and tripped up here, boiled down example:
use aoc_runner_derive::{aoc, aoc_generator};
#[aoc_generator(day2)]
fn input_to_lines(input: &str) -> Vec<&str> {
input.lines().collect()
}
#[aoc(day2, part1)]
fn count_good_passwords(lines: Vec<&str>) -> usize {
lines.len()
}
When I try to build this, I get the error:
Checking advent-of-code-2015 v0.1.0 (/Users/dylanjames/Develop/Languages/Rust/AdventOfCode2020)
error[E0106]: missing lifetime specifier
--> src/day2.rs:9:1
|
9 | #[aoc(day2, part1)]
| ^ expected named lifetime parameter
|
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider introducing a named lifetime parameter
|
9 | #<'a>[aoc(day2, part1)]<'a>
| ^^^^^ ^^^^
I know I'm doing something silly, but am not sure how to coerce the compiler into telling me what, exactly, I've done wrong.
Probably a dup of #20