about summary refs log tree commit diff
path: root/library/std/src/sys/pal/sgx
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-09-12 17:16:38 +0200
committerRalf Jung <post@ralfj.de>2025-09-12 17:16:38 +0200
commit5d8e41b656fa2802c8ab52d4c72ad67e8ff345c2 (patch)
treeb4d49fd5d5dc5aa1e4a0a6577385d3319317321a /library/std/src/sys/pal/sgx
parentac4495a10db552483c0c0a0049962850ca4123c2 (diff)
Revert "Constify SystemTime methods"
This reverts commit 7ce620dd7c6fc3371290b40a1ea28146f0d37031.
The const-hacks introduces bugs, and they make the code harder to maintain.
Let's wait until we can constify these functions without changing their implementation.
Diffstat (limited to 'library/std/src/sys/pal/sgx')
-rw-r--r--library/std/src/sys/pal/sgx/time.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/library/std/src/sys/pal/sgx/time.rs b/library/std/src/sys/pal/sgx/time.rs
index 603dae952ab..db4cf2804bf 100644
--- a/library/std/src/sys/pal/sgx/time.rs
+++ b/library/std/src/sys/pal/sgx/time.rs
@@ -32,22 +32,15 @@ impl SystemTime {
         SystemTime(usercalls::insecure_time())
     }
 
-    #[rustc_const_unstable(feature = "const_system_time", issue = "144517")]
-    pub const fn sub_time(&self, other: &SystemTime) -> Result<Duration, Duration> {
-        // FIXME: ok_or_else with const closures
-        match self.0.checked_sub(other.0) {
-            Some(duration) => Ok(duration),
-            None => Err(other.0 - self.0),
-        }
+    pub fn sub_time(&self, other: &SystemTime) -> Result<Duration, Duration> {
+        self.0.checked_sub(other.0).ok_or_else(|| other.0 - self.0)
     }
 
-    #[rustc_const_unstable(feature = "const_system_time", issue = "144517")]
-    pub const fn checked_add_duration(&self, other: &Duration) -> Option<SystemTime> {
+    pub fn checked_add_duration(&self, other: &Duration) -> Option<SystemTime> {
         Some(SystemTime(self.0.checked_add(*other)?))
     }
 
-    #[rustc_const_unstable(feature = "const_system_time", issue = "144517")]
-    pub const fn checked_sub_duration(&self, other: &Duration) -> Option<SystemTime> {
+    pub fn checked_sub_duration(&self, other: &Duration) -> Option<SystemTime> {
         Some(SystemTime(self.0.checked_sub(*other)?))
     }
 }