From e765ab544a2853211297140f4fc0cd03337283de Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Wed, 2 Nov 2022 02:46:59 -0400 Subject: [PATCH] remove const_eval_limit increase except for cfg(test), which needs it --- Cargo.toml | 2 +- README.md | 7 +++++-- src/lib.rs | 5 ++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d0edfac..e93bbdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "const-crc32" -version = "1.1.0" +version = "1.2.0" edition = "2021" authors = ["Jonathan Strong "] license = "MIT" diff --git a/README.md b/README.md index 48a9358..0964bc5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,10 @@ if used on dynamic data at runtime. Usage should generally be restricted to decl ## `#[const_eval_limit]` -This crate sets `#[const_eval_limit]` to 1,000,000,000 to avoid hitting the limit when -executing the `const fn`, which requires `#![feature(const_eval_limit)]`. +You may need to increase the crate-wide `const_eval_limit` setting to use `const_crc32` for larger byte slices. + +Increating `const_eval_limit` requires the nightly-only `#![feature(const_eval_limit)]`. + +Previously, this crate set the limit itself, however, as of the 2022-10-30 nightly, the value set in `const_crc32` does not increase the limit for crates which use the library. Compile time for `const` data around 100k is less than 1s. diff --git a/src/lib.rs b/src/lib.rs index c263b70..0584ace 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,9 +8,8 @@ //! assert_eq!(CKSUM, 0x414fa339_u32); //! ``` -#![feature(const_eval_limit)] - -#![const_eval_limit = "1000000000"] +#![cfg_attr(test, feature(const_eval_limit))] +#![cfg_attr(test, const_eval_limit = "0")] /// used to generate up a [u32; 256] lookup table in `crc32`. this computes /// the table on demand for a given "index" `i`