diff --git a/.github/workflows/run.yaml b/.github/workflows/run.yaml index 95b409f..fa375cb 100644 --- a/.github/workflows/run.yaml +++ b/.github/workflows/run.yaml @@ -30,7 +30,7 @@ jobs: - name: Run cargo build run: | - cargo build --release + cargo build --profile release-lto env: RUSTFLAGS: "-C target-cpu=native" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 29e8813..4c94d59 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2023-07-20" +channel = "nightly-2023-12-05" components = [ "rustfmt", "clippy" ] diff --git a/src/aoc2022/day17.rs b/src/aoc2022/day17.rs index 90e31d5..c7b6c10 100644 --- a/src/aoc2022/day17.rs +++ b/src/aoc2022/day17.rs @@ -58,7 +58,7 @@ fn set(v: &mut Vec, index: usize) { v[index] = true; } -fn get(v: &Vec, index: usize) -> bool { +fn get(v: &[bool], index: usize) -> bool { if index >= v.len() { false } else { diff --git a/src/aoc2022/day18.rs b/src/aoc2022/day18.rs index 5d53bf3..4489db1 100644 --- a/src/aoc2022/day18.rs +++ b/src/aoc2022/day18.rs @@ -83,7 +83,7 @@ fn neighbors( z: usize, width: usize, ) -> impl Iterator { - std::iter::from_generator(move || { + std::iter::from_coroutine(move || { if x > 0 { yield (x - 1, y, z); } diff --git a/src/aoc2022/day19.rs b/src/aoc2022/day19.rs index fd97bc6..d66e3c4 100644 --- a/src/aoc2022/day19.rs +++ b/src/aoc2022/day19.rs @@ -237,7 +237,7 @@ impl State { let min_use = bp.min_use; let max_use = bp.max_use; - std::iter::from_generator(move || { + std::iter::from_coroutine(move || { // not buying let mut ns = self; ns.collect(); diff --git a/src/aoc2022/grid.rs b/src/aoc2022/grid.rs index 718688a..7b1d6f6 100644 --- a/src/aoc2022/grid.rs +++ b/src/aoc2022/grid.rs @@ -63,7 +63,7 @@ impl Grid { pub fn get_neighbors(&self, x: usize, y: usize) -> impl Iterator { let width = self.width; let height = self.height; - std::iter::from_generator(move || { + std::iter::from_coroutine(move || { if x != 0 { yield (x - 1, y); } diff --git a/src/aoc2023/day3.rs b/src/aoc2023/day3.rs index 64199c3..6df34a9 100644 --- a/src/aoc2023/day3.rs +++ b/src/aoc2023/day3.rs @@ -36,7 +36,7 @@ impl Entry { &'a self, grid: &'b Grid, ) -> impl Iterator + 'b { - std::iter::from_generator(move || { + std::iter::from_coroutine(move || { let x = self.x as i32; let y = self.y as i32; let len = self.len as i32; @@ -61,7 +61,7 @@ impl Entry { #[inline] fn get_entries(input: &Grid) -> impl Iterator + '_ { - std::iter::from_generator(move || { + std::iter::from_coroutine(move || { let mut current = None; for y in 0..input.height { for x in 0..input.width { diff --git a/src/main.rs b/src/main.rs index 75bddc3..664acc9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ #![feature(iter_array_chunks)] #![feature(array_windows)] #![feature(get_many_mut)] -#![feature(generators)] -#![feature(iter_from_generator)] +#![feature(coroutines)] +#![feature(iter_from_coroutine)] use std::time::Duration;