Update to rust 1.44.0 (#10585)

* Update rust 1.44.0

* Update rust nightly 1.46.0

* Update docs

* Fix clippy errors

* Compile all source code with stable and nightly

* Add another note

* script tweaks

* Fix a test...

* Add another workaround

* Add hack

* Increase timeout...

* Revert "Add hack"

This reverts commit 5960f087203be8792ec0728a6755288c317a2788.

* Revert "Add another workaround"

This reverts commit e14300d01ffd1b8e86e676662177545549b45c13.

* Require nightly rustfmt and use older nightly a bit

* Improve document a bit

* Revert now not-existing clippy check...
This commit is contained in:
Ryo Onodera
2020-06-17 01:32:16 +09:00
committed by GitHub
parent 2d2e23ab59
commit 40ccade5cc
11 changed files with 41 additions and 17 deletions

View File

@ -40,10 +40,12 @@ pub fn years_as_slots(years: f64, tick_duration: &Duration, ticks_per_slot: u64)
/// From slots per year to slot duration
pub fn slot_duration_from_slots_per_year(slots_per_year: f64) -> Duration {
// Regarding division by zero potential below: for some reason, if Rust stores an `inf` f64 and
// then converts it to a u64 on use, it always returns 0, as opposed to std::u64::MAX or any
// other huge value
let slot_in_ns = (SECONDS_PER_YEAR * 1_000_000_000.0) / slots_per_year;
// Recently, rust changed from infinity as usize being zero to 2^64-1; ensure it's zero here
let slot_in_ns = if slots_per_year != 0.0 {
(SECONDS_PER_YEAR * 1_000_000_000.0) / slots_per_year
} else {
0.0
};
Duration::from_nanos(slot_in_ns as u64)
}