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 NonZero trait #95157

Closed
3 tasks
nvzqz opened this issue Mar 20, 2022 · 2 comments
Closed
3 tasks

Tracking Issue for NonZero trait #95157

nvzqz opened this issue Mar 20, 2022 · 2 comments
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 20, 2022

Feature gate: #![feature(nonzero_trait)]

This is a tracking issue for adding a NonZero trait to core::num, which includes an associated scalar type and a safety requirement.

Public API

// core::num

pub unsafe trait NonZero: Sealed {
    type Scalar;
}

unsafe impl NonZero for NonZero{U,I}{8,16,32,64,128,size} {
    type Scalar = {u,i}{8,16,32,64,128,size};
}

Steps / History

Unresolved Questions

  • Should the associated type be named Scalar or something else, such as Primitive?
@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 20, 2022
@leonardo-m
Copy link

(Generally I need the opposite: given an integral type tell me what's the corresponding NonZero type).

@dtolnay
Copy link
Member

dtolnay commented Jan 30, 2024

Superseded by #120257.

@dtolnay dtolnay closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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

No branches or pull requests

3 participants