Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use const fn #56

Merged
merged 1 commit into from Oct 10, 2020
Merged

Use const fn #56

merged 1 commit into from Oct 10, 2020

Conversation

@mxpv
Copy link
Contributor

@mxpv mxpv commented Sep 29, 2020

Rust 1.46 significantly extends const fn support, so now it's possible to perform all calculations at compile time (and hence invoke crc in const context). This PR makes all funcs const (with the only exception Digest.update, which mutates state and not yet available in stable).

@mrhooray mrhooray requested a review from akhilles Oct 3, 2020
@mrhooray
Copy link
Owner

@mrhooray mrhooray commented Oct 3, 2020

Thanks for the PR.

I'm a bit rusty and requested @akhilles for a deeper look

any thoughts on release plan?

@mxpv
Copy link
Contributor Author

@mxpv mxpv commented Oct 4, 2020

any thoughts on release plan?

This changes require stable rust, so migration is not that painful.
There is v2 coming up, would it make sense to include these changes in the major release?

@mrhooray
Copy link
Owner

@mrhooray mrhooray commented Oct 4, 2020

Supportive of that.

What do you think about adding/updating some tests to prevent accidental regression?

Copy link
Collaborator

@akhilles akhilles left a comment

Changes look good. Btw, a couple of const fns in src/table.rs and src/util.rs can be simplified quite a bit in Rust 1.46. In terms of release plan, I think it's reasonable to bump MSRV to 1.46 for v2. Might be worth adding fuzz testing before the actual 2.0.0 release.

@mrhooray mrhooray merged commit 6253953 into mrhooray:master Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants