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

Leverage const_mut_refs #667

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Leverage const_mut_refs #667

wants to merge 1 commit into from

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Sep 6, 2024

Replaces macro-based code sharing between the stack-allocated and heap-allocated *Uint types with const fn using const_mut_refs.

Stabilization of this feature is (hopefully) imminent and the PR to do so is in FCP: rust-lang/rust#129195

I will keep this a draft until the feature has actually been stabilized and made it into a stable Rust release.

Edit: stabilization is currently slated for the 1.83.0 milestone, which is set to be released on November 28th, 2024.

tarcieri added a commit that referenced this pull request Sep 19, 2024
This version leverages the new `core::error::Error` stabilization.

We plan on bumping MSRV to 1.83 before a final release to get the
`const_mut_refs` stabilization (#667), so this is something of an
interim bump.
tarcieri added a commit that referenced this pull request Sep 19, 2024
This version leverages the new `core::error::Error` stabilization.

We plan on bumping MSRV to 1.83 before a final release to get the
`const_mut_refs` stabilization (#667), so this is something of an
interim bump.
tarcieri added a commit that referenced this pull request Sep 19, 2024
This version leverages the new `core::error::Error` stabilization.

We plan on bumping MSRV to 1.83 before a final release to get the
`const_mut_refs` stabilization (#667), so this is something of an
interim bump.
@tarcieri tarcieri force-pushed the const_mut_refs branch 4 times, most recently from c0ebcb2 to 64b622e Compare October 8, 2024 01:13
@tarcieri tarcieri force-pushed the const_mut_refs branch 2 times, most recently from 5c2b906 to acf1a26 Compare October 16, 2024 03:21
Replaces macro-based code sharing between the stack-allocated and
heap-allocated `*Uint` types with `const fn` using `const_mut_refs`.
@tarcieri tarcieri marked this pull request as ready for review October 16, 2024 16:39
@tarcieri tarcieri changed the title [WIP] Leverage const_mut_refs Leverage const_mut_refs Oct 16, 2024
@tarcieri tarcieri requested a review from fjarri October 16, 2024 16:39
@tarcieri
Copy link
Member Author

Went ahead and bumped this to 1.8.3.0-beta and removed WIP/draft, though I'll hold off on merging this until 1.83 is stable.

This is just the beginning of what's possible: we can rewrite pretty much all of Uint to use in-place mutation as the core implementation, and have the non-*Assign-like operations clone and mutate values in-place, which I would speculate should generally improve performance.

This will also make it possible to have many more common implementations shared among BoxedUint and Uint, where much of BoxedUint is already written to use in-place operations to avoid heap allocations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant