-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Add Duration from nanos u128 #139243
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
base: master
Are you sure you want to change the base?
Add Duration from nanos u128 #139243
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks for taking this over! r? libs |
Happy to take this up. noted. |
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in coverage instrumentation. cc @Zalathar Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in match checking cc @Nadrieril Some changes occurred to the CTFE machinery These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in match lowering cc @Nadrieril Some changes occurred in compiler/rustc_codegen_llvm/src/builder/autodiff.rs cc @ZuseZ4 Some changes occurred in compiler/rustc_passes/src/check_attr.rs Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_gcc
cc @davidtwco, @compiler-errors, @TaKO8Ki Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs cc @ZuseZ4 Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt changes to the core type system Some changes occurred in compiler/rustc_sanitizers cc @rcvalle These commits modify compiler targets. HIR ty lowering was modified cc @fmease Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in compiler/rustc_attr_data_structures Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter |
|
@omanirudh it looks like you wound up with bad commit history somehow. You should be able to fix this by rebasing your branch, check out https://rustc-dev-guide.rust-lang.org/git.html#rebasing |
Re-triggering CI after rebase. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
It looks like you did a merge rather than a rebase - that will need to get fixed since this branch still contains some weird history. Were you able to try what was suggested in rustc-dev-guide (linked above)? |
What does this PR do?
This draft PR adds the
Duration::from_nanos_u128
function to handle durations that exceed the range ofu64
, allowing for time spans greater than ~584 years.Motivation
The current
Duration
API does not support creating durations from nanoseconds represented asu128
. This addition addresses that limitation.Tracking Issue
Fixes #139201
Details
Introduced
Duration::from_nanos_u128
as aconst fn
similar to other functions in the file.Ensured safety by validating the nanoseconds before using
unsafe
code.To do : complete the documentation and examples for the new function.
r? @RalfJung