-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Impl From<NonZero<T>> for T #54240
Impl From<NonZero<T>> for T #54240
Conversation
Looks good to me. Let’s get team sign off since impls are insta-stable: @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
src/test/run-pass/nonzero.rs
Outdated
fn main() { | ||
use std::num::NonZeroU32; | ||
let nz = NonZeroU32::new(5).unwrap(); | ||
let num: u32 = nz.into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: perhaps just make this a doctest on the impl, so users can see it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of the types like String
/PathBuf
in std doesn't have specific docs for their From
implementation, and invoking .from/.into
is kind of intuition, so I think that's fine without doctest? but if it's really needed, I'd add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not a need. I just found a run-pass test odd for this, as x.py test src/libcore
doesn't run those. src/libcore/tests/nonzero.rs
might also be a reasonable place for the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/libcore/tests/nonzero.rs
also makes sense to me.
src/libcore/num/mod.rs
Outdated
@@ -93,6 +93,13 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st | |||
|
|||
} | |||
|
|||
#[stable(feature = "nonzero", since = "1.28.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think it'll be 1.31 now?
This comment has been minimized.
This comment has been minimized.
The CI failure means this should use a new |
This comment has been minimized.
This comment has been minimized.
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. |
@bors: r+ |
📌 Commit 95c1d81 has been approved by |
Impl From<NonZero<T>> for T Closes #54171 r? @SimonSapin
☀️ Test successful - status-appveyor, status-travis |
Closes #54171
r? @SimonSapin