diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90a6ec1fb5..8b91e79052 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -347,7 +347,12 @@ jobs: - target: x86_64-unknown-openbsd - target: x86_64-unknown-haiku - target: armv7-unknown-linux-uclibceabihf - - target: i686-unknown-hurd-gnu + # Disable Hurd due to + # 1. https://github.com/rust-lang/libc/issues/4421 + # 2. https://github.com/nix-rust/nix/pull/2635#issuecomment-2842062528 + # + # We can bring it back when 1 gets fixed and it is applied to the std lib + # - target: i686-unknown-hurd-gnu steps: - name: checkout uses: actions/checkout@v4 @@ -360,13 +365,6 @@ jobs: - name: install src run: rustup component add rust-src - # Cargo uses the latest version of libc(without lock file), which is, at the time of writing - # this, 0.2.172. And the hurd target is broken with 0.2.172: https://github.com/rust-lang/libc/issues/4421 - # So we need to downgrade it. - - name: downgrade libc to 0.2.171 on hurd - if: ${{ matrix.target == 'i686-unknown-hurd-gnu' }} - run: cargo update -p libc --precise 0.2.171 - - name: build uses: ./.github/actions/build with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 650119b99a..4e320bc824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ This project adheres to [Semantic Versioning](https://semver.org/). # Change Log +## [0.30.1] - 2025-05-04 + +### Fixed + +- doc.rs build + ([#2634](https://github.com/nix-rust/nix/pull/2634)) + + ## [0.30.0] - 2025-04-29 diff --git a/Cargo.toml b/Cargo.toml index bb827d6642..9970f121cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "nix" description = "Rust friendly bindings to *nix APIs" edition = "2021" -version = "0.30.0" +version = "0.30.1" rust-version = "1.69" authors = ["The nix-rust Project Developers"] repository = "https://github.com/nix-rust/nix" @@ -22,7 +22,7 @@ targets = [ "x86_64-unknown-openbsd", "x86_64-unknown-netbsd", "x86_64-unknown-dragonfly", - "x86_64-fuchsia", + "x86_64-unknown-fuchsia", "x86_64-unknown-redox", "x86_64-unknown-illumos" ] diff --git a/README.md b/README.md index 1da81443ae..7d1d7c534c 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ The following targets are supported by `nix`:
  • armv7-unknown-linux-uclibceabihf
  • powerpc64-unknown-linux-gnu
  • -
  • x86_64-fuchsia
  • +
  • x86_64-unknown-fuchsia
  • x86_64-unknown-dragonfly
  • x86_64-unknown-haiku
  • x86_64-unknown-linux-gnux32
  • diff --git a/examples/getifaddrs.rs b/examples/getifaddrs.rs index 602c9e829f..20ae766d04 100644 --- a/examples/getifaddrs.rs +++ b/examples/getifaddrs.rs @@ -30,7 +30,7 @@ fn main() { .address .as_ref() .and_then(SockaddrStorage::family) - .map(|af| format!("{:?}", af)) + .map(|af| format!("{af:?}")) .unwrap_or("".to_owned()); match ( &addr.address, @@ -39,16 +39,14 @@ fn main() { &addr.destination, ) { (Some(a), Some(nm), Some(b), None) => { - println!("\t{} {} netmask {} broadcast {}", family, a, nm, b) + println!("\t{family} {a} netmask {nm} broadcast {b}") } (Some(a), Some(nm), None, None) => { - println!("\t{} {} netmask {}", family, a, nm) + println!("\t{family} {a} netmask {nm}") } - (Some(a), None, None, None) => println!("\t{} {}", family, a), - (Some(a), None, None, Some(d)) => { - println!("\t{} {} -> {}", family, a, d) - } - x => todo!("{:?}", x), + (Some(a), None, None, None) => println!("\t{family} {a}"), + (Some(a), None, None, Some(d)) => println!("\t{family} {a} -> {d}"), + x => todo!("{x:?}"), } } } diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 44633dd53d..867d207da3 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -38,7 +38,7 @@ libc_bitflags! { /// Additional parameters for [`mmap`]. pub struct MapFlags: c_int { /// Compatibility flag. Ignored. - #[cfg(not(target_os = "solaris"))] + #[cfg(not(any(target_os = "solaris", target_os = "redox")))] MAP_FILE; /// Share this mapping. Mutually exclusive with `MAP_PRIVATE`. MAP_SHARED; @@ -82,7 +82,7 @@ libc_bitflags! { /// Do not reserve swap space for this mapping. /// /// This was removed in FreeBSD 11 and is unused in DragonFlyBSD. - #[cfg(not(any(freebsdlike, target_os = "aix", target_os = "hurd")))] + #[cfg(not(any(freebsdlike, target_os = "aix", target_os = "hurd", target_os = "redox")))] MAP_NORESERVE; /// Populate page tables for a mapping. #[cfg(linux_android)] @@ -281,7 +281,7 @@ libc_enum! { #[cfg(linux_android)] MADV_DODUMP, /// Specify that the application no longer needs the pages in the given range. - #[cfg(not(any(target_os = "aix", target_os = "hurd", target_os = "cygwin")))] + #[cfg(not(any(target_os = "aix", target_os = "hurd", target_os = "cygwin", target_os = "redox")))] MADV_FREE, /// Request that the system not flush the current range to disk unless it needs to. #[cfg(freebsdlike)] @@ -357,7 +357,7 @@ libc_bitflags! { } } -#[cfg(not(any(target_os = "haiku", target_os = "cygwin")))] +#[cfg(not(any(target_os = "haiku", target_os = "cygwin", target_os = "redox")))] libc_bitflags! { /// Flags for [`mlockall`]. pub struct MlockAllFlags: c_int { @@ -400,7 +400,7 @@ pub unsafe fn munlock(addr: NonNull, length: size_t) -> Result<()> { /// Locked pages never move to the swap area. For more information, see [`mlockall(2)`]. /// /// [`mlockall(2)`]: https://man7.org/linux/man-pages/man2/mlockall.2.html -#[cfg(not(any(target_os = "haiku", target_os = "cygwin")))] +#[cfg(not(any(target_os = "haiku", target_os = "cygwin", target_os = "redox")))] pub fn mlockall(flags: MlockAllFlags) -> Result<()> { unsafe { Errno::result(libc::mlockall(flags.bits())) }.map(drop) } @@ -410,7 +410,7 @@ pub fn mlockall(flags: MlockAllFlags) -> Result<()> { /// For more information, see [`munlockall(2)`]. /// /// [`munlockall(2)`]: https://man7.org/linux/man-pages/man2/munlockall.2.html -#[cfg(not(any(target_os = "haiku", target_os = "cygwin")))] +#[cfg(not(any(target_os = "haiku", target_os = "cygwin", target_os = "redox")))] pub fn munlockall() -> Result<()> { unsafe { Errno::result(libc::munlockall()) }.map(drop) } diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 17b033170d..c17c7be39e 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -52,7 +52,6 @@ feature! { pub mod memfd; } -#[cfg(not(target_os = "redox"))] feature! { #![feature = "mman"] pub mod mman; diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index bb6c54fd21..09be1d68b5 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -2428,7 +2428,7 @@ mod tests { let addr = UnixAddr::new_abstract(name.as_bytes()).unwrap(); let sun_path1 = - unsafe { &(*addr.as_ptr()).sun_path[..addr.path_len()] }; + unsafe { &(&(*addr.as_ptr()).sun_path)[..addr.path_len()] }; let sun_path2 = [ 0, 110, 105, 120, 0, 97, 98, 115, 116, 114, 97, 99, 116, 0, 116, 101, 115, 116, diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 95598f470c..42906a65e2 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -200,7 +200,7 @@ pub fn test_path_to_sock_addr() { let expect: &[c_char] = unsafe { slice::from_raw_parts(path.as_ptr().cast(), path.len()) }; - assert_eq!(unsafe { &(*addr.as_ptr()).sun_path[..8] }, expect); + assert_eq!(unsafe { &(&(*addr.as_ptr()).sun_path)[..8] }, expect); assert_eq!(addr.path(), Some(actual)); } diff --git a/test/sys/test_sockopt.rs b/test/sys/test_sockopt.rs index c7b1df593c..87ad72a953 100644 --- a/test/sys/test_sockopt.rs +++ b/test/sys/test_sockopt.rs @@ -289,11 +289,7 @@ fn test_tcp_congestion() { let val = getsockopt(&fd, sockopt::TcpCongestion).unwrap(); let bytes = val.as_os_str().as_bytes(); for b in bytes.iter() { - assert_ne!( - *b, 0, - "OsString should contain no embedded NULs: {:?}", - val - ); + assert_ne!(*b, 0, "OsString should contain no embedded NULs: {val:?}"); } setsockopt(&fd, sockopt::TcpCongestion, &val).unwrap();