From 0446f11a46f5b44c8fa6ea04670dcdd515249dd1 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 17 Dec 2021 14:12:35 +0100 Subject: [PATCH] 2020: bump nom version I was getting a compilation error (something in the latest Rust compiler?), related to a nom dependency (bitvec v0.19), but nom 7 does not depend on bitvec by default anymore, yay! The move + clone closures feel kind of wrong though --- Cargo.lock | 70 ++++++++------------------------------------ aoc2020/Cargo.toml | 2 +- aoc2020/src/day18.rs | 6 ++-- 3 files changed, 17 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b620f0d..3c4ec6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,7 +88,7 @@ version = "0.1.0" dependencies = [ "anyhow", "aoc", - "bitvec 0.22.3", + "bitvec", "rand", ] @@ -100,12 +100,6 @@ dependencies = [ "criterion", ] -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "atty" version = "0.2.14" @@ -129,18 +123,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitvec" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ba35e9565969edb811639dbebfe34edc0368e472c5018474c8eb2543397f81" -dependencies = [ - "funty", - "radium 0.5.3", - "tap", - "wyz 0.2.0", -] - [[package]] name = "bitvec" version = "0.22.3" @@ -148,9 +130,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" dependencies = [ "funty", - "radium 0.6.2", + "radium", "tap", - "wyz 0.4.0", + "wyz", ] [[package]] @@ -427,19 +409,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec", - "bitflags", - "cfg-if", - "ryu", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.108" @@ -482,14 +451,19 @@ dependencies = [ ] [[package]] -name = "nom" -version = "6.1.1" +name = "minimal-lexical" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d521ee2250f619dd5e06515ba405858d249edc8fae9ddee2dba0695e57db01b" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" dependencies = [ - "bitvec 0.19.4", - "lexical-core", "memchr", + "minimal-lexical", "version_check", ] @@ -576,12 +550,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" - [[package]] name = "radium" version = "0.6.2" @@ -748,12 +716,6 @@ dependencies = [ "serde", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "syn" version = "1.0.82" @@ -926,12 +888,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "wyz" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" - [[package]] name = "wyz" version = "0.4.0" diff --git a/aoc2020/Cargo.toml b/aoc2020/Cargo.toml index c42c975..10346de 100644 --- a/aoc2020/Cargo.toml +++ b/aoc2020/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" aoc = { path = "../aoc" } anyhow = "1.0" itertools = "0.9" -nom = "6.0" +nom = "7.0" [lib] path = "src/lib.rs" diff --git a/aoc2020/src/day18.rs b/aoc2020/src/day18.rs index 12df6fe..4df8254 100644 --- a/aoc2020/src/day18.rs +++ b/aoc2020/src/day18.rs @@ -84,7 +84,7 @@ fn operator_expr(input: &str) -> IResult<&str, Expr> { fold_many0( pair(delimited(char(' '), operator, char(' ')), term), - first_term, + move || first_term.clone(), |acc, (op, val)| Expr::Op(Box::new(acc), op, Box::new(val)), )(i) } @@ -97,7 +97,7 @@ fn plus(input: &str) -> IResult<&str, Expr> { delimited(char(' '), char('+'), char(' ')), term_plus_priority, ), - first_term, + move || first_term.clone(), |acc, (_, val)| Expr::Op(Box::new(acc), Operator::Addition, Box::new(val)), )(i) } @@ -107,7 +107,7 @@ fn mul(input: &str) -> IResult<&str, Expr> { fold_many0( pair(delimited(char(' '), char('*'), char(' ')), plus), - first_factor, + move || first_factor.clone(), |acc, (_, val)| Expr::Op(Box::new(acc), Operator::Multiplication, Box::new(val)), )(i) }