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

Create NonZero trait with primitive associated type #95155

Closed
wants to merge 3 commits into from

Conversation

nvzqz
Copy link
Contributor

@nvzqz nvzqz commented Mar 20, 2022

This enables getting the primitive integer type for a nonzero type through a type alias.

r? @yaahc

This enables getting the primitive integer type for a nonzero type
through a type alias.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 20, 2022
///
/// let n: <NonZeroInt as NonZero>::Scalar = 1;
/// ```
type Scalar;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to suggestions for a better name.

@rust-log-analyzer

This comment has been minimized.

@nvzqz nvzqz mentioned this pull request Mar 20, 2022
3 tasks
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- src/num/nonzero.rs - num::nonzero::NonZero::Scalar (line 27) stdout ----
error[E0432]: unresolved import `std::num::NonZero`
 --> src/num/nonzero.rs:28:16
  |
4 | use std::num::{NonZero, NonZeroU32};
  |                |
  |                |
  |                no `NonZero` in `num`
  |                help: a similar name exists in the module: `NonZeroI8`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
Couldn't compile the test.

@yaahc
Copy link
Member

yaahc commented Mar 21, 2022

Hey @nvzqz, can you add more detail to the top level comment explaining how you plan to use this API? I'm a little confused by the description you gave, is the NonZero type the one being aliased or are you creating an alias using the type exposed via this trait? Ideally I'd love to see a link to a branch on a crate where you intend to use this API testing out the API and demonstrating the intended usage.

@yaahc yaahc added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Mar 23, 2022
@yaahc
Copy link
Member

yaahc commented Mar 23, 2022

@rustbot label: -S-waiting-on-review +S-waiting-on-author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2022
@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 11, 2022
@JohnCSimon
Copy link
Member

@nvzqz
Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you do please open the PR BEFORE you force push to it, else you won't be able to reopen.
Thanks for your contribution.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this May 8, 2022
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants