diff --git a/doc/toolchain_limitations.md b/doc/toolchain_limitations.md index f2e4c22943..248ddc167e 100644 --- a/doc/toolchain_limitations.md +++ b/doc/toolchain_limitations.md @@ -436,20 +436,6 @@ const _: () = Ok::<(), ()>(()).expect(""); ``` -### `[tag:const_result_ok]` `Result::ok` is not `const fn` - -*Upstream PR:* [rust-lang/rust#92385](https://github.com/rust-lang/rust/pull/92385) will unstably add this - -```rust -Ok::<(), ()>(()).ok(); -``` - -```rust,compile_fail,E0015 -// error[E0015]: cannot call non-const fn `Result::<(), ()>::ok` in constants -const _: () = { Ok::<(), ()>(()).ok(); }; -``` - - ### `[tag:const_result_map]` `Result::map[_err]` is not `const fn` ```rust diff --git a/src/r3_core/src/lib.rs b/src/r3_core/src/lib.rs index 86ebc86ed8..6ce0dc0375 100644 --- a/src/r3_core/src/lib.rs +++ b/src/r3_core/src/lib.rs @@ -24,6 +24,7 @@ #![feature(const_refs_to_cell)] #![feature(maybe_uninit_slice)] #![feature(const_nonnull_new)] +#![feature(const_result_drop)] #![feature(const_impl_trait)] #![feature(const_option_ext)] #![feature(const_ptr_offset)] diff --git a/src/r3_core/src/time/time.rs b/src/r3_core/src/time/time.rs index dd278182b3..544925151c 100644 --- a/src/r3_core/src/time/time.rs +++ b/src/r3_core/src/time/time.rs @@ -140,9 +140,11 @@ impl Time { /// `None` if the result overflows the representable range of `Duration`. #[inline] pub const fn duration_since(self, reference: Self) -> Option { - Some(Duration::from_micros(result_ok( - (self.micros as i128 - reference.micros as i128).try_into(), - )?)) + Some(Duration::from_micros( + (self.micros as i128 - reference.micros as i128) + .try_into() + .ok()?, + )) } /// Advance the time by `duration` and return the result. @@ -278,12 +280,3 @@ impl TryFrom