Skip to content

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

New issue

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

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

Already on GitHub? # to your account

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: An issue tracking the progress of sth. like the implementation of an RFC 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: An issue tracking the progress of sth. like the implementation of an RFC 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 :-)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC 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