diff options
| author | Ralf Jung <post@ralfj.de> | 2025-09-12 17:16:38 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-09-12 17:16:38 +0200 |
| commit | 5d8e41b656fa2802c8ab52d4c72ad67e8ff345c2 (patch) | |
| tree | b4d49fd5d5dc5aa1e4a0a6577385d3319317321a /library/std/src/sys/pal/solid | |
| parent | ac4495a10db552483c0c0a0049962850ca4123c2 (diff) | |
| download | rust-5d8e41b656fa2802c8ab52d4c72ad67e8ff345c2.tar.gz rust-5d8e41b656fa2802c8ab52d4c72ad67e8ff345c2.zip | |
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/solid')
| -rw-r--r-- | library/std/src/sys/pal/solid/time.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/library/std/src/sys/pal/solid/time.rs b/library/std/src/sys/pal/solid/time.rs index e35e60df1a0..c39d715c6a6 100644 --- a/library/std/src/sys/pal/solid/time.rs +++ b/library/std/src/sys/pal/solid/time.rs @@ -39,8 +39,7 @@ impl SystemTime { Self(t) } - #[rustc_const_unstable(feature = "const_system_time", issue = "144517")] - pub const fn sub_time(&self, other: &SystemTime) -> Result<Duration, Duration> { + pub fn sub_time(&self, other: &SystemTime) -> Result<Duration, Duration> { if self.0 >= other.0 { Ok(Duration::from_secs((self.0 as u64).wrapping_sub(other.0 as u64))) } else { @@ -48,13 +47,11 @@ impl SystemTime { } } - #[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_unsigned(other.as_secs())?)) } - #[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_unsigned(other.as_secs())?)) } } |
