Skip to content

Commit e756c96

Browse files
Merge #1862
1862: Bump MSRV to 1.63 for I/O safety r=asomers a=SUPERCILEX Prep for #1750 Co-authored-by: Alex Saveau <[email protected]>
2 parents 3286c4d + bc2b023 commit e756c96

15 files changed

+67
-80
lines changed

.cirrus.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
RUSTDOCFLAGS: -D warnings
1010
TOOL: cargo
1111
# The MSRV
12-
TOOLCHAIN: 1.56.1
12+
TOOLCHAIN: 1.63.0
1313
ZFLAGS:
1414

1515
# Tests that don't require executing the build binaries
@@ -140,18 +140,18 @@ task:
140140
matrix:
141141
- name: Linux aarch64
142142
arm_container:
143-
image: rust:1.56
143+
image: rust:1.63.0
144144
env:
145145
RUSTFLAGS: --cfg graviton -D warnings
146146
TARGET: aarch64-unknown-linux-gnu
147147
- name: Linux x86_64
148148
container:
149-
image: rust:1.56
149+
image: rust:1.63.0
150150
env:
151151
TARGET: x86_64-unknown-linux-gnu
152152
- name: Linux x86_64 musl
153153
container:
154-
image: rust:1.56
154+
image: rust:1.63.0
155155
env:
156156
TARGET: x86_64-unknown-linux-musl
157157
setup_script:
@@ -176,7 +176,7 @@ task:
176176
# Tasks for cross-compiling, but no testing
177177
task:
178178
container:
179-
image: rust:1.56
179+
image: rust:1.63.0
180180
env:
181181
BUILD: check
182182
HOST: x86_64-unknown-linux-gnu
@@ -250,7 +250,7 @@ task:
250250

251251
task:
252252
container:
253-
image: rust:1.56
253+
image: rust:1.63.0
254254
env:
255255
BUILD: check
256256
name: Redox x86_64

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1111
(#[1662](https://github.com/nix-rust/nix/pull/1662))
1212

1313
### Changed
14+
15+
- The MSRV is now 1.63
16+
([#1862](https://github.com/nix-rust/nix/pull/1862))
17+
1418
### Fixed
1519
### Removed
1620

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "nix"
33
description = "Rust friendly bindings to *nix APIs"
4-
edition = "2018"
4+
edition = "2021"
55
version = "0.26.1"
6-
rust-version = "1.56"
6+
rust-version = "1.63"
77
authors = ["The nix-rust Project Developers"]
88
repository = "https://github.com/nix-rust/nix"
99
license = "MIT"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Tier 3:
8989

9090
## Minimum Supported Rust Version (MSRV)
9191

92-
nix is supported on Rust 1.56.1 and higher. Its MSRV will not be
92+
nix is supported on Rust 1.63 and higher. Its MSRV will not be
9393
changed in the future without bumping the major or minor version.
9494

9595
## Contributing

src/sys/aio.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl AioCb {
163163
0 => Ok(()),
164164
num if num > 0 => Err(Errno::from_i32(num)),
165165
-1 => Err(Errno::last()),
166-
num => panic!("unknown aio_error return value {:?}", num),
166+
num => panic!("unknown aio_error return value {num:?}"),
167167
}
168168
}
169169

src/sys/socket/addr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ mod tests {
23732373
sdl_slen: 0,
23742374
..unsafe { mem::zeroed() }
23752375
});
2376-
format!("{}", la);
2376+
format!("{la}");
23772377
}
23782378

23792379
#[cfg(all(
@@ -2495,7 +2495,7 @@ mod tests {
24952495
fn display() {
24962496
let s = "127.0.0.1:8080";
24972497
let addr = SockaddrIn::from_str(s).unwrap();
2498-
assert_eq!(s, format!("{}", addr));
2498+
assert_eq!(s, format!("{addr}"));
24992499
}
25002500

25012501
#[test]
@@ -2515,7 +2515,7 @@ mod tests {
25152515
fn display() {
25162516
let s = "[1234:5678:90ab:cdef::1111:2222]:8080";
25172517
let addr = SockaddrIn6::from_str(s).unwrap();
2518-
assert_eq!(s, format!("{}", addr));
2518+
assert_eq!(s, format!("{addr}"));
25192519
}
25202520

25212521
#[test]

src/sys/socket/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use libc::{
1212
self, c_int, c_void, iovec, size_t, socklen_t, CMSG_DATA, CMSG_FIRSTHDR,
1313
CMSG_LEN, CMSG_NXTHDR,
1414
};
15-
use std::convert::TryFrom;
1615
use std::io::{IoSlice, IoSliceMut};
1716
#[cfg(feature = "net")]
1817
use std::net;

src/sys/socket/sockopt.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ use crate::Result;
66
use cfg_if::cfg_if;
77
use libc::{self, c_int, c_void, socklen_t};
88
use std::ffi::{OsStr, OsString};
9+
use std::mem::{self, MaybeUninit};
910
#[cfg(target_family = "unix")]
1011
use std::os::unix::ffi::OsStrExt;
1112
use std::os::unix::io::RawFd;
12-
use std::{
13-
convert::TryFrom,
14-
mem::{self, MaybeUninit},
15-
};
1613

1714
// Constants
1815
// TCP_CA_NAME_MAX isn't defined in user space include files

src/sys/time.rs

+15-17
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ impl TimeValLike for TimeSpec {
261261
fn seconds(seconds: i64) -> TimeSpec {
262262
assert!(
263263
(TS_MIN_SECONDS..=TS_MAX_SECONDS).contains(&seconds),
264-
"TimeSpec out of bounds; seconds={}",
265-
seconds
264+
"TimeSpec out of bounds; seconds={seconds}",
266265
);
267266
let mut ts = zero_init_timespec();
268267
ts.tv_sec = seconds as time_t;
@@ -428,20 +427,20 @@ impl fmt::Display for TimeSpec {
428427

429428
let sec = abs.tv_sec();
430429

431-
write!(f, "{}", sign)?;
430+
write!(f, "{sign}")?;
432431

433432
if abs.tv_nsec() == 0 {
434-
if abs.tv_sec() == 1 {
435-
write!(f, "{} second", sec)?;
433+
if sec == 1 {
434+
write!(f, "1 second")?;
436435
} else {
437-
write!(f, "{} seconds", sec)?;
436+
write!(f, "{sec} seconds")?;
438437
}
439438
} else if abs.tv_nsec() % 1_000_000 == 0 {
440-
write!(f, "{}.{:03} seconds", sec, abs.tv_nsec() / 1_000_000)?;
439+
write!(f, "{sec}.{:03} seconds", abs.tv_nsec() / 1_000_000)?;
441440
} else if abs.tv_nsec() % 1_000 == 0 {
442-
write!(f, "{}.{:06} seconds", sec, abs.tv_nsec() / 1_000)?;
441+
write!(f, "{sec}.{:06} seconds", abs.tv_nsec() / 1_000)?;
443442
} else {
444-
write!(f, "{}.{:09} seconds", sec, abs.tv_nsec())?;
443+
write!(f, "{sec}.{:09} seconds", abs.tv_nsec())?;
445444
}
446445

447446
Ok(())
@@ -497,8 +496,7 @@ impl TimeValLike for TimeVal {
497496
fn seconds(seconds: i64) -> TimeVal {
498497
assert!(
499498
(TV_MIN_SECONDS..=TV_MAX_SECONDS).contains(&seconds),
500-
"TimeVal out of bounds; seconds={}",
501-
seconds
499+
"TimeVal out of bounds; seconds={seconds}"
502500
);
503501
#[cfg_attr(target_env = "musl", allow(deprecated))]
504502
// https://github.com/rust-lang/libc/issues/1848
@@ -662,18 +660,18 @@ impl fmt::Display for TimeVal {
662660

663661
let sec = abs.tv_sec();
664662

665-
write!(f, "{}", sign)?;
663+
write!(f, "{sign}")?;
666664

667665
if abs.tv_usec() == 0 {
668-
if abs.tv_sec() == 1 {
669-
write!(f, "{} second", sec)?;
666+
if sec == 1 {
667+
write!(f, "1 second")?;
670668
} else {
671-
write!(f, "{} seconds", sec)?;
669+
write!(f, "{sec} seconds")?;
672670
}
673671
} else if abs.tv_usec() % 1000 == 0 {
674-
write!(f, "{}.{:03} seconds", sec, abs.tv_usec() / 1000)?;
672+
write!(f, "{sec}.{:03} seconds", abs.tv_usec() / 1000)?;
675673
} else {
676-
write!(f, "{}.{:06} seconds", sec, abs.tv_usec())?;
674+
write!(f, "{sec}.{:06} seconds", abs.tv_usec())?;
677675
}
678676

679677
Ok(())

test/sys/test_aio.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ fn test_aio_suspend() {
610610
let r = aio_suspend(&cbbuf[..], Some(timeout));
611611
match r {
612612
Err(Errno::EINTR) => continue,
613-
Err(e) => panic!("aio_suspend returned {:?}", e),
613+
Err(e) => panic!("aio_suspend returned {e:?}"),
614614
Ok(_) => (),
615615
};
616616
}

test/sys/test_signal.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ fn test_sigprocmask() {
5454
// test don't make sense.
5555
assert!(
5656
!old_signal_set.contains(SIGNAL),
57-
"the {:?} signal is already blocked, please change to a \
58-
different one",
59-
SIGNAL
57+
"the {SIGNAL:?} signal is already blocked, please change to a \
58+
different one"
6059
);
6160

6261
// Now block the signal.
@@ -71,8 +70,7 @@ fn test_sigprocmask() {
7170
.expect("expect to be able to retrieve old signals");
7271
assert!(
7372
old_signal_set.contains(SIGNAL),
74-
"expected the {:?} to be blocked",
75-
SIGNAL
73+
"expected the {SIGNAL:?} to be blocked"
7674
);
7775

7876
// Reset the signal.

test/sys/test_socket.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ mod recvfrom {
626626
println!("IPv6 not available, skipping test.");
627627
return;
628628
}
629-
Err(e) => panic!("bind: {}", e),
629+
Err(e) => panic!("bind: {e}"),
630630
Ok(()) => (),
631631
}
632632
let ssock = socket(
@@ -1272,7 +1272,7 @@ fn test_scm_credentials() {
12721272
ControlMessageOwned::ScmCredentials(cred) => cred,
12731273
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
12741274
ControlMessageOwned::ScmCreds(cred) => cred,
1275-
other => panic!("unexpected cmsg {:?}", other),
1275+
other => panic!("unexpected cmsg {other:?}"),
12761276
};
12771277
assert!(received_cred.is_none());
12781278
assert_eq!(cred.pid(), getpid().as_raw());
@@ -1550,7 +1550,7 @@ fn loopback_address(
15501550
Err(e) => {
15511551
let stdioerr = io::stderr();
15521552
let mut handle = stdioerr.lock();
1553-
writeln!(handle, "getifaddrs: {:?}", e).unwrap();
1553+
writeln!(handle, "getifaddrs: {e:?}").unwrap();
15541554
return None;
15551555
}
15561556
};
@@ -2347,7 +2347,7 @@ mod linux_errqueue {
23472347
}
23482348
*ext_err
23492349
} else {
2350-
panic!("Unexpected control message {:?}", cmsg);
2350+
panic!("Unexpected control message {cmsg:?}");
23512351
}
23522352
},
23532353
)
@@ -2398,7 +2398,7 @@ mod linux_errqueue {
23982398
}
23992399
*ext_err
24002400
} else {
2401-
panic!("Unexpected control message {:?}", cmsg);
2401+
panic!("Unexpected control message {cmsg:?}");
24022402
}
24032403
},
24042404
)
@@ -2432,7 +2432,7 @@ mod linux_errqueue {
24322432
MsgFlags::empty(),
24332433
) {
24342434
assert_eq!(e, Errno::EADDRNOTAVAIL);
2435-
println!("{:?} not available, skipping test.", af);
2435+
println!("{af:?} not available, skipping test.");
24362436
return;
24372437
}
24382438

test/test_fcntl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ mod test_posix_fallocate {
559559
let err = posix_fallocate(rd as RawFd, 0, 100).unwrap_err();
560560
match err {
561561
Errno::EINVAL | Errno::ENODEV | Errno::ESPIPE | Errno::EBADF => (),
562-
errno => panic!("unexpected errno {}", errno,),
562+
errno => panic!("unexpected errno {errno}",),
563563
}
564564
}
565565
}

0 commit comments

Comments
 (0)