Skip to content

Commit 35469b9

Browse files
authoredMar 10, 2025··
Merge pull request #4311 from tgross35/ctest-syntax-fix
Change the range syntax that is giving `ctest` problems
2 parents 3914f82 + 33c320a commit 35469b9

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed
 

‎Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ targets = [
4848
"armv7r-none-eabihf",
4949
# FIXME(hexagon): excluded due to duplicate symbol errors
5050
# "hexagon-unknown-linux-musl",
51-
"i586-pc-windows-msvc",
5251
"i586-unknown-linux-gnu",
5352
"i586-unknown-linux-musl",
5453
"i686-linux-android",

‎ci/verify-build.sh

-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ armebv7r-none-eabihf \
189189
armv7-wrs-vxworks-eabihf \
190190
armv7r-none-eabi \
191191
armv7r-none-eabihf \
192-
i586-pc-windows-msvc \
193192
i686-pc-windows-msvc \
194193
i686-unknown-haiku \
195194
i686-unknown-netbsd \
+7-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
//! Compare libc's KERNEL_VERSION macro against a specific kernel version.
22
3-
#[cfg(
4-
target_os = "linux",
5-
)]
3+
#[cfg(target_os = "linux")]
64
mod t {
75
use libc;
86

97
#[test]
108
fn test_kernel_version() {
11-
unsafe {
12-
assert_eq!(libc::KERNEL_VERSION(6, 0, 0), 393216);
13-
}
9+
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 0) }, 393216);
10+
// Check that the patch level saturates
11+
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 255) }, 393471);
12+
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 256) }, 393471);
13+
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 300) }, 393471);
14+
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, u32::MAX) }, 393471);
1415
}
1516
}

‎src/unix/linux_like/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1755,11 +1755,7 @@ safe_f! {
17551755

17561756
#[allow(ellipsis_inclusive_range_patterns)]
17571757
pub {const} fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 {
1758-
((a << 16) + (b << 8))
1759-
+ match c {
1760-
0..=255 => c,
1761-
_ => 255,
1762-
}
1758+
((a << 16) + (b << 8)) + if c > 255 { 255 } else { c }
17631759
}
17641760
}
17651761

0 commit comments

Comments
 (0)
Please sign in to comment.