diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-09-11 14:06:29 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-11 14:06:29 +1000 |
| commit | c79c990df166a0beb5c9e0bcabfb1989e27308b4 (patch) | |
| tree | 00ba4b5354649530237c7f34b7967173bd3a66c5 /library/std/src | |
| parent | 88b51304f98a5bb60e2fc20c7b3f8f5b18bd8249 (diff) | |
| parent | 23edc4dd4266836980dc3e71a1f5ddd151a3e92a (diff) | |
| download | rust-c79c990df166a0beb5c9e0bcabfb1989e27308b4.tar.gz rust-c79c990df166a0beb5c9e0bcabfb1989e27308b4.zip | |
Rollup merge of #146379 - madsmtm:fix-platform_version-test, r=tgross35
Fix `compare_against_sw_vers` test The `saturating_sub` doesn't actually perform its intended since the version numbers are signed integers (which I changed in a later revision of https://github.com/rust-lang/rust/pull/138944). Fixes the issue described in https://github.com/rust-lang/rust/pull/138944#issuecomment-3270662876. r? tgross35
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/platform_version/darwin/tests.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/sys/platform_version/darwin/tests.rs b/library/std/src/sys/platform_version/darwin/tests.rs index eecd58ec79e..17b2cc18ec0 100644 --- a/library/std/src/sys/platform_version/darwin/tests.rs +++ b/library/std/src/sys/platform_version/darwin/tests.rs @@ -35,9 +35,9 @@ fn compare_against_sw_vers() { assert_eq!(__isOSVersionAtLeast(major, minor, subminor), 1); // One lower is available - assert_eq!(__isOSVersionAtLeast(major, minor, subminor.saturating_sub(1)), 1); - assert_eq!(__isOSVersionAtLeast(major, minor.saturating_sub(1), subminor), 1); - assert_eq!(__isOSVersionAtLeast(major.saturating_sub(1), minor, subminor), 1); + assert_eq!(__isOSVersionAtLeast(major, minor, (subminor as u32).saturating_sub(1) as i32), 1); + assert_eq!(__isOSVersionAtLeast(major, (minor as u32).saturating_sub(1) as i32, subminor), 1); + assert_eq!(__isOSVersionAtLeast((major as u32).saturating_sub(1) as i32, minor, subminor), 1); // One higher isn't available assert_eq!(__isOSVersionAtLeast(major, minor, subminor + 1), 0); |
