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

Tracking Issue for BITS constant for non-zero integers #94881

Closed
3 tasks done
nvzqz opened this issue Mar 12, 2022 · 1 comment · Fixed by #101514
Closed
3 tasks done

Tracking Issue for BITS constant for non-zero integers #94881

nvzqz opened this issue Mar 12, 2022 · 1 comment · Fixed by #101514
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@nvzqz
Copy link
Contributor

nvzqz commented Mar 12, 2022

Feature gate: #![feature(nonzero_bits)]

This is a tracking issue for adding the associated BITS constant to NonZero{U,I}{8,16,32,64,128,size}.

This is useful when a type alias refers to either a regular or non-zero integer.

Public API

Repeated for all NonZeroX integers:

impl NonZeroUsize {
    pub const BITS: u32 = usize::BITS;
}

Steps / History

Unresolved Questions

  • None yet.
@nvzqz nvzqz added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Mar 12, 2022
@leonardo-m
Copy link

In the end I hope we'll have proper general ranged integral types in Rust (as in Ada), that will also replace all the NonZeroXX types :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants