rust-lang / rust-lang/rust

Tracking Issue for const stability of unsigned bigint helpers

Open
#152,015 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue S-tracking-unimplemented T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Feature gate: #![feature(bigint_helper_methods)] (for now)

This is a tracking issue for the const stability of the bigint helper methods added in 1.91.0.

Public API
impl uN {
    const fn carrying_add(self, rhs: uN, carry: bool) -> (uN, bool);
    const fn borrowing_sub(self, rhs: uN, borrow: bool) -> (uN, bool);
    const fn carrying_mul(self, rhs: uN, carry: uN) -> (uN, uN);
    const fn carrying_mul_add(self, rhs: uN, carry: uN, add: uN) -> (uN, uN);
}
Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Notes

These were originally not stabilised as part of the original per @scottmcm:

I did not const-stabilize them in this PR because the fallbacks are using #[const_trait] plus there's two new intrinsics involved, so I didn't want to also open those cans of worms here. Given that both intrinsics have fallbacks, and thus don't do anything that can't already be expressed in existing Rust, const-stabilizing these should be straight-forward once the underlying machinery is allowed on stable. But that doesn't need to keep these from being usable at runtime in the mean time.

Note that at minimum, a T-lang FCP would be needed on a stabilization PR to accept the const-stabilization of those intrinsics. Additionally, we will probably be blocked on #[const_trait] being stable unless there's a blessing from at least a few folks involved to stabilize these methods regardless.

Unresolved Questions
  • None yet.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the public API, the linked stabilization PR, and the fallback implementation in library/core/src/intrinsics/fallback.rs, along with the notes about const_trait and the new intrinsics. Done means completing the final commenting period and resolving the stated stabilization requirements for carrying_add, borrowing_sub, carrying_mul, and carrying_mul_add.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.