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

fix: lossy truncation in checked Instant arithmetic #110

Merged

Conversation

nissaofthesea
Copy link
Contributor

@nissaofthesea nissaofthesea commented Dec 29, 2024

Fixes and tests #109.

Unresolved Questions

  • The test case currently asserts that offsets of 1 << 64 nanos always overflow, which relies on Instants being implemented as 64-bit nanosecond counts. It would be correct just to check that the Instant is not left unchanged, so should I remove those last two assertions? Removed as of caae534

src/instant.rs Outdated Show resolved Hide resolved
The main thing we care about here is that the Duration is not
truncated.

Signed-off-by: Nissa <[email protected]>
@nissaofthesea
Copy link
Contributor Author

Looks like merging is blocked on a test runner for WASM. I don't have experience with WASM infrastructure so its not clear to me where in Rust the issue is.

@tobz
Copy link
Member

tobz commented Dec 31, 2024

Hmm, weird. I'll try and take a look at this today or tomorrow.

@tobz
Copy link
Member

tobz commented Jan 1, 2025

Gah, the WASM stuff is so finicky.

Since it seems pretty obvious that it's not relevant to ensure that the WASM tests pass for this change, I'm going to merge as-is.

@tobz tobz merged commit 7135d6f into metrics-rs:main Jan 1, 2025
30 of 66 checks passed
@tobz
Copy link
Member

tobz commented Jan 1, 2025

Will cut a release shortly.

@tobz
Copy link
Member

tobz commented Jan 1, 2025

Released as [email protected].

Thanks again for your contribution!

@nissaofthesea
Copy link
Contributor Author

Thanks! Happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants