File tree Expand file tree Collapse file tree 3 files changed +6
-26
lines changed Expand file tree Collapse file tree 3 files changed +6
-26
lines changed Original file line number Diff line number Diff line change @@ -436,20 +436,6 @@ const _: () = Ok::<(), ()>(()).expect("");
436436```
437437
438438
439- ### ` [tag:const_result_ok] ` ` Result::ok ` is not ` const fn `
440-
441- * Upstream PR:* [ rust-lang/rust #92385 ] ( https://github.com/rust-lang/rust/pull/92385 ) will unstably add this
442-
443- ``` rust
444- Ok :: <(), ()>(()). ok ();
445- ```
446-
447- ``` rust,compile_fail,E0015
448- // error[E0015]: cannot call non-const fn `Result::<(), ()>::ok` in constants
449- const _: () = { Ok::<(), ()>(()).ok(); };
450- ```
451-
452-
453439### ` [tag:const_result_map] ` ` Result::map[_err] ` is not ` const fn `
454440
455441``` rust
Original file line number Diff line number Diff line change 2424#![ feature( const_refs_to_cell) ]
2525#![ feature( maybe_uninit_slice) ]
2626#![ feature( const_nonnull_new) ]
27+ #![ feature( const_result_drop) ]
2728#![ feature( const_impl_trait) ]
2829#![ feature( const_option_ext) ]
2930#![ feature( const_ptr_offset) ]
Original file line number Diff line number Diff line change @@ -140,9 +140,11 @@ impl Time {
140140 /// `None` if the result overflows the representable range of `Duration`.
141141 #[ inline]
142142 pub const fn duration_since ( self , reference : Self ) -> Option < Duration > {
143- Some ( Duration :: from_micros ( result_ok (
144- ( self . micros as i128 - reference. micros as i128 ) . try_into ( ) ,
145- ) ?) )
143+ Some ( Duration :: from_micros (
144+ ( self . micros as i128 - reference. micros as i128 )
145+ . try_into ( )
146+ . ok ( ) ?,
147+ ) )
146148 }
147149
148150 /// Advance the time by `duration` and return the result.
@@ -278,12 +280,3 @@ impl TryFrom<Time> for chrono_0p4::DateTime<chrono_0p4::Utc> {
278280}
279281
280282// TODO: Add more tests
281-
282- /// Polyfill for `[ref:const_result_ok]`
283- #[ inline]
284- const fn result_ok < T , E : ~const Drop > ( x : Result < T , E > ) -> Option < T > {
285- match x {
286- Ok ( x) => Some ( x) ,
287- Err ( _x) => None ,
288- }
289- }
You can’t perform that action at this time.
0 commit comments