-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
Panic Documentation #638
Panic Documentation #638
Conversation
This patch adds some documentation for functions that may panic.
4867da6
to
2d0e648
Compare
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 a start! I only have a couple minor changes; it otherwise LGTM. The one for Instant
actually made me think that it can be worked around, but as it's not yet, the comment is correct.
Also, don't worry about the coverage CI check. It's broken at the moment due to a bug in the Rust compiler.
time/src/date_time.rs
Outdated
@@ -1224,6 +1236,9 @@ impl From<DateTime<offset_kind::Fixed>> for SystemTime { | |||
feature = "wasm-bindgen" | |||
))] | |||
impl From<js_sys::Date> for DateTime<offset_kind::Fixed> { | |||
/// # Panics | |||
/// | |||
/// This may panic if the timestamp can not be represented by the return type. |
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.
/// This may panic if the timestamp can not be represented by the return type. | |
/// This may panic if the timestamp can not be represented. |
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.
Updated as part of a single commit.
time/src/duration.rs
Outdated
@@ -1289,6 +1315,9 @@ impl Add<Duration> for StdDuration { | |||
impl_add_assign!(Duration: Self, StdDuration); | |||
|
|||
impl AddAssign<Duration> for StdDuration { | |||
/// # Panics | |||
/// | |||
/// This may panic if the resulting addition cannot be represented by the return type. |
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.
/// This may panic if the resulting addition cannot be represented by the return type. | |
/// This may panic if the resulting addition cannot be represented. |
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.
Updated as part of a single commit.
time/src/duration.rs
Outdated
@@ -1336,6 +1374,9 @@ impl Sub<Duration> for StdDuration { | |||
impl_sub_assign!(Duration: Self, StdDuration); | |||
|
|||
impl SubAssign<Duration> for StdDuration { | |||
/// # Panics | |||
/// | |||
/// This may panic if the resulting subtraction can not be represented by the return type. |
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.
/// This may panic if the resulting subtraction can not be represented by the return type. | |
/// This may panic if the resulting subtraction can not be represented. |
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.
Updated as part of a single commit.
Thanks for the review. I thought the code coverage was a separate issue so I ignored it for now. Let me know if you would like me to squash my commits. |
Thanks! No need to squash; I can do that on my end. |
This is an attempt to add some documentation for #623.