Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions library/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_from_nanos_u128)]
/// use std::time::Duration;
///
/// let nanos = 10_u128.pow(24) + 321;
Expand All @@ -326,12 +325,12 @@ impl Duration {
/// assert_eq!(10_u64.pow(15), duration.as_secs());
/// assert_eq!(321, duration.subsec_nanos());
/// ```
#[unstable(feature = "duration_from_nanos_u128", issue = "139201")]
// This is necessary because of const `try_from`, but can be removed if a trait-free impl is used instead
#[rustc_const_unstable(feature = "duration_from_nanos_u128", issue = "139201")]
#[stable(feature = "duration_from_nanos_u128", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "duration_from_nanos_u128", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
#[inline]
#[track_caller]
#[rustc_allow_const_fn_unstable(const_trait_impl, const_convert)] // for `u64::try_from`
pub const fn from_nanos_u128(nanos: u128) -> Duration {
const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
let Ok(secs) = u64::try_from(nanos / NANOS_PER_SEC) else {
Expand Down
1 change: 0 additions & 1 deletion library/coretests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#![feature(drop_guard)]
#![feature(duration_constants)]
#![feature(duration_constructors)]
#![feature(duration_from_nanos_u128)]
#![feature(error_generic_member_access)]
#![feature(exact_div)]
#![feature(exact_size_is_empty)]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![feature(derive_coerce_pointee)]
#![feature(arbitrary_self_types)]
#![feature(iter_advance_by)]
#![feature(duration_from_nanos_u128)]
#![cfg_attr(bootstrap, feature(duration_from_nanos_u128))]
// Configure clippy and other lints
#![allow(
clippy::collapsible_else_if,
Expand Down