Skip to content

Commit 0e0e181

Browse files
authored
Tweak the #[cfg()] statements in sys/ioctl/linux a little (#2104)
* Tweak the #[cfg()] statements in sys/ioctl/linux a little This should give Nix a better chance of building on architectures that aren't specifically-supported. * Raise MSRV to 1.65.0 Because cross now requires that through a transitive dependency. I don't know how to install cross for CI with a lower Rust version.
1 parent 2d18d63 commit 0e0e181

File tree

5 files changed

+47
-51
lines changed

5 files changed

+47
-51
lines changed

.cirrus.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
RUSTFLAGS: -D warnings
1010
RUSTDOCFLAGS: -D warnings
1111
TOOL: cargo
12-
MSRV: 1.63.0
12+
MSRV: 1.65.0
1313
ZFLAGS:
1414

1515
# Tests that don't require executing the build binaries
@@ -137,7 +137,7 @@ task:
137137
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
138138
- sh rustup.sh -y --profile=minimal --default-toolchain $MSRV
139139
- . $HOME/.cargo/env
140-
- cargo install cross --version 0.2.1 # cross 0.2.2 bumped the MSRV to 1.58.1
140+
- cargo install cross --version 0.2.5
141141
<< : *TEST
142142
before_cache_script: rm -rf $CARGO_HOME/registry/index
143143

@@ -146,7 +146,7 @@ task:
146146
matrix:
147147
- name: Linux aarch64
148148
arm_container:
149-
image: rust:1.63.0
149+
image: rust:1.65.0
150150
cpu: 1
151151
depends_on:
152152
- FreeBSD 14 amd64 & i686
@@ -160,13 +160,13 @@ task:
160160
TARGET: aarch64-unknown-linux-gnu
161161
- name: Linux x86_64
162162
container:
163-
image: rust:1.63.0
163+
image: rust:1.65.0
164164
cpu: 1
165165
env:
166166
TARGET: x86_64-unknown-linux-gnu
167167
- name: Linux x86_64 musl
168168
container:
169-
image: rust:1.63.0
169+
image: rust:1.65.0
170170
cpu: 1
171171
depends_on:
172172
- FreeBSD 14 amd64 & i686
@@ -199,7 +199,7 @@ task:
199199
# Tasks for cross-compiling, but no testing
200200
task:
201201
container:
202-
image: rust:1.63.0
202+
image: rust:1.65.0
203203
cpu: 1
204204
depends_on:
205205
- FreeBSD 14 amd64 & i686

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3232

3333
### Changed
3434

35-
- The MSRV is now 1.63
35+
- The MSRV is now 1.65
3636
([#1862](https://github.com/nix-rust/nix/pull/1862))
37+
([#2104](https://github.com/nix-rust/nix/pull/2104))
3738
- The epoll interface now uses a type.
3839
([#1882](https://github.com/nix-rust/nix/pull/1882))
3940
- With I/O-safe type applied in `pty::OpenptyResult` and `pty::ForkptyResult`,

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "nix"
33
description = "Rust friendly bindings to *nix APIs"
44
edition = "2021"
55
version = "0.26.1"
6-
rust-version = "1.63"
6+
rust-version = "1.65"
77
authors = ["The nix-rust Project Developers"]
88
repository = "https://github.com/nix-rust/nix"
99
license = "MIT"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The following targets are supported by `nix`:
104104

105105
## Minimum Supported Rust Version (MSRV)
106106

107-
nix is supported on Rust 1.63 and higher. Its MSRV will not be
107+
nix is supported on Rust 1.65 and higher. Its MSRV will not be
108108
changed in the future without bumping the major or minor version.
109109

110110
## Contributing

src/sys/ioctl/linux.rs

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use cfg_if::cfg_if;
2+
13
/// The datatype used for the ioctl number
24
#[cfg(any(target_os = "android", target_env = "musl"))]
35
#[doc(hidden)]
@@ -14,48 +16,41 @@ pub const NRBITS: ioctl_num_type = 8;
1416
#[doc(hidden)]
1517
pub const TYPEBITS: ioctl_num_type = 8;
1618

17-
#[cfg(any(
18-
target_arch = "mips",
19-
target_arch = "mips64",
20-
target_arch = "powerpc",
21-
target_arch = "powerpc64",
22-
target_arch = "sparc64"
23-
))]
24-
mod consts {
25-
#[doc(hidden)]
26-
pub const NONE: u8 = 1;
27-
#[doc(hidden)]
28-
pub const READ: u8 = 2;
29-
#[doc(hidden)]
30-
pub const WRITE: u8 = 4;
31-
#[doc(hidden)]
32-
pub const SIZEBITS: u8 = 13;
33-
#[doc(hidden)]
34-
pub const DIRBITS: u8 = 3;
35-
}
36-
37-
// "Generic" ioctl protocol
38-
#[cfg(any(
39-
target_arch = "x86",
40-
target_arch = "arm",
41-
target_arch = "s390x",
42-
target_arch = "x86_64",
43-
target_arch = "aarch64",
44-
target_arch = "riscv32",
45-
target_arch = "riscv64",
46-
target_arch = "loongarch64"
47-
))]
48-
mod consts {
49-
#[doc(hidden)]
50-
pub const NONE: u8 = 0;
51-
#[doc(hidden)]
52-
pub const READ: u8 = 2;
53-
#[doc(hidden)]
54-
pub const WRITE: u8 = 1;
55-
#[doc(hidden)]
56-
pub const SIZEBITS: u8 = 14;
57-
#[doc(hidden)]
58-
pub const DIRBITS: u8 = 2;
19+
cfg_if! {
20+
if #[cfg(any(
21+
target_arch = "mips",
22+
target_arch = "mips64",
23+
target_arch = "powerpc",
24+
target_arch = "powerpc64",
25+
target_arch = "sparc64"
26+
))] {
27+
mod consts {
28+
#[doc(hidden)]
29+
pub const NONE: u8 = 1;
30+
#[doc(hidden)]
31+
pub const READ: u8 = 2;
32+
#[doc(hidden)]
33+
pub const WRITE: u8 = 4;
34+
#[doc(hidden)]
35+
pub const SIZEBITS: u8 = 13;
36+
#[doc(hidden)]
37+
pub const DIRBITS: u8 = 3;
38+
}
39+
} else {
40+
// "Generic" ioctl protocol
41+
mod consts {
42+
#[doc(hidden)]
43+
pub const NONE: u8 = 0;
44+
#[doc(hidden)]
45+
pub const READ: u8 = 2;
46+
#[doc(hidden)]
47+
pub const WRITE: u8 = 1;
48+
#[doc(hidden)]
49+
pub const SIZEBITS: u8 = 14;
50+
#[doc(hidden)]
51+
pub const DIRBITS: u8 = 2;
52+
}
53+
}
5954
}
6055

6156
pub use self::consts::*;

0 commit comments

Comments
 (0)