Skip to content

Make NonZero constructors generic.#120521

Merged
bors merged 5 commits intorust-lang:masterfrom
reitermarkus:generic-nonzero-constructors
Feb 8, 2024
Merged

Make NonZero constructors generic.#120521
bors merged 5 commits intorust-lang:masterfrom
reitermarkus:generic-nonzero-constructors

Conversation

@reitermarkus
Copy link
Contributor

@reitermarkus reitermarkus commented Jan 31, 2024

This makes NonZero constructors generic, so that NonZero::new can be used without turbofish syntax.

Tracking issue: #120257

I cannot figure out how to make this work with const traits. Not sure if I'm using it wrong or whether there's a bug:

101 |         if n == T::ZERO {
    |            ^^^^^^^^^^^^ expected `host`, found `true`
    |
    = note: expected constant `host`
               found constant `true`

r? @dtolnay

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.