diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-23 23:40:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-23 23:40:27 +0200 |
| commit | c2e11d7e430656b8651d3cbef017d76f83dc4688 (patch) | |
| tree | bd9f982902f1088b1a7f6e6a3a6b1f6c1e9cb490 /library/core | |
| parent | 975e6c8fec280816d24fbde6b8dfe19620f2efe6 (diff) | |
| parent | 5dde557fc49ff0268f9890786ef050802b309a75 (diff) | |
| download | rust-c2e11d7e430656b8651d3cbef017d76f83dc4688.tar.gz rust-c2e11d7e430656b8651d3cbef017d76f83dc4688.zip | |
Rollup merge of #146818 - npmccallum:total_cmp, r=fee1-dead
constify {float}::total_cmp()
Diffstat (limited to 'library/core')
| -rw-r--r-- | library/core/src/num/f128.rs | 3 | ||||
| -rw-r--r-- | library/core/src/num/f16.rs | 3 | ||||
| -rw-r--r-- | library/core/src/num/f32.rs | 3 | ||||
| -rw-r--r-- | library/core/src/num/f64.rs | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index 6088fb6fa17..b0c9e9ef05e 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -1196,7 +1196,8 @@ impl f128 { #[inline] #[must_use] #[unstable(feature = "f128", issue = "116909")] - pub fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { + #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] + pub const fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { let mut left = self.to_bits() as i128; let mut right = other.to_bits() as i128; diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index 3f66c5973d4..56db92f91fc 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -1175,7 +1175,8 @@ impl f16 { #[inline] #[must_use] #[unstable(feature = "f16", issue = "116909")] - pub fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { + #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] + pub const fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { let mut left = self.to_bits() as i16; let mut right = other.to_bits() as i16; diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index ebce89e5b3d..57be4d8d30a 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -1353,9 +1353,10 @@ impl f32 { /// } /// ``` #[stable(feature = "total_cmp", since = "1.62.0")] + #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] #[must_use] #[inline] - pub fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { + pub const fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { let mut left = self.to_bits() as i32; let mut right = other.to_bits() as i32; diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index 91e3949fc39..748956ae980 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -1351,9 +1351,10 @@ impl f64 { /// } /// ``` #[stable(feature = "total_cmp", since = "1.62.0")] + #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] #[must_use] #[inline] - pub fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { + pub const fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering { let mut left = self.to_bits() as i64; let mut right = other.to_bits() as i64; |
