Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett

Add functions `Duration::try_from_secs_{f32, f64}`

These functions allow constructing a Duration from a floating point value that could be out of range without panicking.

Tracking issue: #83400
This commit is contained in:
Yuki Okushi
2021-06-15 17:40:03 +09:00
committed by GitHub
3 changed files with 132 additions and 24 deletions

View File

@@ -597,6 +597,9 @@ impl Error for char::ParseCharError {
#[unstable(feature = "try_reserve", reason = "new API", issue = "48043")]
impl Error for alloc::collections::TryReserveError {}
#[unstable(feature = "duration_checked_float", issue = "83400")]
impl Error for core::time::FromSecsError {}
// Copied from `any.rs`.
impl dyn Error + 'static {
/// Returns `true` if the boxed type is the same as `T`