Skip to content

Commit 352446a

Browse files
committed
Relax lifetime requirements for FdSet::{insert, remove, contains}
Fixes #2130
1 parent 154a8a4 commit 352446a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](https://semver.org/).
55

6+
## [Unreleased] - ReleaseDate
7+
8+
### Fixed
9+
10+
- Relaxed lifetime requirements for `FdSet::{insert, remove, contains}`.
11+
([#2135](https://github.com/nix-rust/nix/pull/2135))
12+
613
## [0.27.1] - 2023-08-28
714

815
### Fixed

src/sys/select.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ impl<'fd> FdSet<'fd> {
4141
}
4242

4343
/// Add a file descriptor to an `FdSet`
44-
pub fn insert<Fd: AsFd>(&mut self, fd: &'fd Fd) {
44+
pub fn insert<Fd: AsFd + 'fd>(&mut self, fd: Fd) {
4545
assert_fd_valid(fd.as_fd().as_raw_fd());
4646
unsafe { libc::FD_SET(fd.as_fd().as_raw_fd(), &mut self.set) };
4747
}
4848

4949
/// Remove a file descriptor from an `FdSet`
50-
pub fn remove<Fd: AsFd>(&mut self, fd: &'fd Fd) {
50+
pub fn remove<Fd: AsFd + 'fd>(&mut self, fd: Fd) {
5151
assert_fd_valid(fd.as_fd().as_raw_fd());
5252
unsafe { libc::FD_CLR(fd.as_fd().as_raw_fd(), &mut self.set) };
5353
}
5454

5555
/// Test an `FdSet` for the presence of a certain file descriptor.
56-
pub fn contains<Fd: AsFd>(&self, fd: &'fd Fd) -> bool {
56+
pub fn contains<Fd: AsFd + 'fd>(&self, fd: Fd) -> bool {
5757
assert_fd_valid(fd.as_fd().as_raw_fd());
5858
unsafe { libc::FD_ISSET(fd.as_fd().as_raw_fd(), &self.set) }
5959
}

0 commit comments

Comments
 (0)