Skip to content

Commit a72936d

Browse files
asomersSteveLauC
andauthored
Address multiple CI failures (#2642)
* Fix the test_fcntl::test_posix_fallocate::success test with recent ZFS POSIX 1003.1-2024 Issue 8 changed the error code for this operation, and recent ZFS versions have followed suit. So the test should accept either the old error code (EINVAL) or the new one (ENOTSUP). https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_fallocate.html * Clippy cleanup: mismatched_lifetime_syntaxes * fixup to Clippy cleanup: mismatched_lifetime_syntaxes * Remove the `PartialEq` and `Eq` implementations from `SigHandler` Because it never worked reliably anyway. See https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html for more info. Alternatively, we could only remove `Eq` and leave `PartialEq`. We would be able to guarantee equality or inequality in most cases, but would be unable to prove that different handler functions are actually different. I think users would find that confusing. Reported by: Clippy (unpredictable_function_pointer_comparisons) * Fix rustdoc::redundant_explicit_links warning on nightly * Clippy::doc_overindented_list_items Fix the lint in one file, but suppress it in src/sys/aio.rs, where the docstrings are nicely formated for reading in either plain text or html. * fixup to Clippy cleanup: mismatched_lifetime_syntaxes * fixup to Fix rustdoc::redundant_explicit_links warning on nightly * clippy fix: mismatched-lifetime-syntaxes * chore: pin libc to 0.2.172 to avoid the broken timespec --------- Co-authored-by: Steve Lau <stevelauc@outlook.com>
1 parent befe95e commit a72936d

File tree

16 files changed

+51
-48
lines changed

16 files changed

+51
-48
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ targets = [
2828
]
2929

3030
[dependencies]
31-
libc = { version = "0.2.171", features = ["extra_traits"] }
31+
libc = { version = "=0.2.172", features = ["extra_traits"] }
3232
bitflags = "2.3.3"
3333
cfg-if = "1.0"
3434
pin-utils = { version = "0.1.0", optional = true }

changelog/2642.removed.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Removed `Eq` and `PartialEq` implementations from `SigHandler`, because they
2+
never worked reliably. The suggested alternative is `matches!`. For example:
3+
```
4+
let h: SigHandler = ...
5+
if matches!(h, SigHandler::SigIgn) {
6+
...
7+
}
8+
```

src/dir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Dir {
119119
}
120120

121121
/// Returns an iterator of `Result<Entry>` which rewinds when finished.
122-
pub fn iter(&mut self) -> Iter {
122+
pub fn iter(&mut self) -> Iter<'_> {
123123
Iter(self)
124124
}
125125
}
@@ -133,7 +133,7 @@ impl Dir {
133133
unsafe impl Send for Dir {}
134134

135135
impl std::os::fd::AsFd for Dir {
136-
fn as_fd(&self) -> std::os::fd::BorrowedFd {
136+
fn as_fd(&self) -> std::os::fd::BorrowedFd<'_> {
137137
let raw_fd = self.as_raw_fd();
138138

139139
// SAFETY:

src/fcntl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,15 +745,15 @@ pub enum FcntlArg<'a> {
745745
F_SETFL(OFlag), // O_NONBLOCK
746746
/// Set or clear a file segment lock
747747
F_SETLK(&'a libc::flock),
748-
/// Like [`F_SETLK`](FcntlArg::F_SETLK) except that if a shared or exclusive lock is blocked by
748+
/// Like [`F_SETLK`] except that if a shared or exclusive lock is blocked by
749749
/// other locks, the process waits until the request can be satisfied.
750750
F_SETLKW(&'a libc::flock),
751751
/// Get the first lock that blocks the lock description
752752
F_GETLK(&'a mut libc::flock),
753753
/// Acquire or release an open file description lock
754754
#[cfg(linux_android)]
755755
F_OFD_SETLK(&'a libc::flock),
756-
/// Like [`F_OFD_SETLK`](FcntlArg::F_OFD_SETLK) except that if a conflicting lock is held on
756+
/// Like [`F_OFD_SETLK`] except that if a conflicting lock is held on
757757
/// the file, then wait for that lock to be released.
758758
#[cfg(linux_android)]
759759
F_OFD_SETLKW(&'a libc::flock),

src/mqueue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub fn mq_remove_nonblock(mqd: &MqdT) -> Result<MqAttr> {
315315
#[cfg(any(target_os = "linux", target_os = "netbsd", target_os = "dragonfly"))]
316316
impl AsFd for MqdT {
317317
/// Borrow the underlying message queue descriptor.
318-
fn as_fd(&self) -> BorrowedFd {
318+
fn as_fd(&self) -> BorrowedFd<'_> {
319319
// SAFETY: [MqdT] will only contain a valid fd by construction.
320320
unsafe { BorrowedFd::borrow_raw(self.0) }
321321
}

src/sys/aio.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
//! [`cancel`](trait.Aio.html#method.cancel) or
2424
//! [`aio_cancel_all`](fn.aio_cancel_all.html), though the operating system may
2525
//! not support this for all filesystems and devices.
26+
#![allow(clippy::doc_overindented_list_items)] // It looks better this way
2627
#[cfg(target_os = "freebsd")]
2728
use std::io::{IoSlice, IoSliceMut};
2829
use std::{
@@ -313,7 +314,7 @@ pub trait Aio {
313314
fn error(self: Pin<&mut Self>) -> Result<()>;
314315

315316
/// Returns the underlying file descriptor associated with the operation.
316-
fn fd(&self) -> BorrowedFd;
317+
fn fd(&self) -> BorrowedFd<'_>;
317318

318319
/// Does this operation currently have any in-kernel state?
319320
///
@@ -572,8 +573,9 @@ impl<'a> AioRead<'a> {
572573
/// * `fd`: File descriptor to read from
573574
/// * `offs`: File offset
574575
/// * `buf`: A memory buffer. It must outlive the `AioRead`.
575-
/// * `prio`: If POSIX Prioritized IO is supported, then the operation
576-
/// will be prioritized at the process's priority level minus `prio`
576+
/// * `prio`: If POSIX Prioritized IO is supported, then the
577+
/// operation will be prioritized at the process's
578+
/// priority level minus `prio`.
577579
/// * `sigev_notify`: Determines how you will be notified of event completion.
578580
pub fn new(
579581
fd: BorrowedFd<'a>,
@@ -802,8 +804,9 @@ impl<'a> AioWrite<'a> {
802804
/// * `fd`: File descriptor to write to
803805
/// * `offs`: File offset
804806
/// * `buf`: A memory buffer. It must outlive the `AioWrite`.
805-
/// * `prio`: If POSIX Prioritized IO is supported, then the operation
806-
/// will be prioritized at the process's priority level minus `prio`
807+
/// * `prio`: If POSIX Prioritized IO is supported, then the
808+
/// operation will be prioritized at the process's
809+
/// priority level minus `prio`
807810
/// * `sigev_notify`: Determines how you will be notified of event completion.
808811
pub fn new(
809812
fd: BorrowedFd<'a>,

src/sys/eventfd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl EventFd {
101101
}
102102
}
103103
impl AsFd for EventFd {
104-
fn as_fd(&self) -> BorrowedFd {
104+
fn as_fd(&self) -> BorrowedFd<'_> {
105105
self.0.as_fd()
106106
}
107107
}

src/sys/fanotify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl FanotifyEvent {
229229
/// The file descriptor of the event. If the value is `None` when reading
230230
/// from the fanotify group, this event is to notify that a group queue
231231
/// overflow occured.
232-
pub fn fd(&self) -> Option<BorrowedFd> {
232+
pub fn fd(&self) -> Option<BorrowedFd<'_>> {
233233
if self.0.fd == libc::FAN_NOFD {
234234
None
235235
} else {
@@ -443,4 +443,4 @@ impl Fanotify {
443443
fd
444444
}
445445
}
446-
}
446+
}

src/sys/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl<'fd> FdSet<'fd> {
107107
/// assert_eq!(fds, vec![4, 9]);
108108
/// ```
109109
#[inline]
110-
pub fn fds(&self, highest: Option<RawFd>) -> Fds {
110+
pub fn fds(&self, highest: Option<RawFd>) -> Fds<'_, '_> {
111111
Fds {
112112
set: self,
113113
range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),

src/sys/signal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ impl<'a> IntoIterator for &'a SigSet {
753753
}
754754

755755
/// A signal handler.
756-
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
756+
#[derive(Clone, Copy, Debug, Hash)]
757757
pub enum SigHandler {
758758
/// Default signal handling.
759759
SigDfl,
@@ -1035,7 +1035,7 @@ pub fn sigprocmask(how: SigmaskHow, set: Option<&SigSet>, oldset: Option<&mut Si
10351035
/// - If less than `-1`, the signal is sent to all processes whose
10361036
/// process group ID is equal to the absolute value of `pid`.
10371037
/// * `signal` - Signal to send. If `None`, error checking is performed
1038-
/// but no signal is actually sent.
1038+
/// but no signal is actually sent.
10391039
///
10401040
/// See Also
10411041
/// [`kill(2)`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html)

0 commit comments

Comments
 (0)