-
-
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
OffsetDateTime subtracted by OffsetDateTime can panic #481
Comments
I'm not sure if it is correct to assert in this case as you only create part of Duration |
In |
The assertions are very much intentional, and were added recently. They are only present when in debug mode, so there's zero overhead in an optimized build.
Just because an assertion isn't present doesn't mean the code was correct. I will look into the panic, but the assertions are there for a reason: to catch bugs. |
Well, unnecessary complicated implementation is reason to catch bugs. |
Please be respectful. You have not read the underlying code. I know this because your suggested implementation is irreconcilable with the internal structure. Handling time is extremely difficult and I have written nearly all of the code in this crate. All that I have written was from scratch, a large portion of it even without known algorithms. Bugs exist; that's the nature of programming. I have already provided justification for the debug assertions — something you have apparently never used in Rust. You're free to disagree on whether they should be there, but the evidence is clear: they should be. Were they not, this bug wouldn't have been caught. Describing code as "useless" and "unnecessarily complicated" is not only unproductive, it is just plain rude. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Otherwise the rollover tests (may) panic. We can bump the version once time-rs/time#481 is resolved.
2275: Pin time to `0.3.9` because of debug assert panic r=bonomat a=da-kami Otherwise the rollover tests (may) panic. We can bump the version once time-rs/time#481 is resolved. --- I am still surprised that the tests did not fail when we merged the bump. This would mean this is only a problem *sometimes*, which is not good. I wonder if there is a bigger problem in `time` that may cause issues. (`@klochowicz` mentioned this in #2274 as well). Resolves #2274 Co-authored-by: Daniel Karzel <daniel@comit.network>
I have verified that using |
The new version fixes the following issue: time-rs/time#481
The new version fixes the following issue: time-rs/time#481
I hit panic due to this assert
https://github.com/time-rs/time/blob/main/src/duration.rs#L205=
What I was subtracting
Callstack
The text was updated successfully, but these errors were encountered: