Skip to content

Commit

Permalink
remove const_eval_limit increase except for cfg(test), which needs it
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Strong committed Nov 2, 2022
1 parent 7324963 commit e765ab5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "const-crc32"
version = "1.1.0"
version = "1.2.0"
edition = "2021"
authors = ["Jonathan Strong <[email protected]>"]
license = "MIT"
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit e765ab5

Please sign in to comment.