Skip to content

Commit

Permalink
Bump MSRV to 1.63 (#117)
Browse files Browse the repository at this point in the history
Removes the build script and bumps bitflags to v2
  • Loading branch information
notgull authored Jun 11, 2023
1 parent e161698 commit 5df378f
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
# When updating this, the reminder to update the minimum supported
# Rust version in Cargo.toml.
rust: ['1.48']
rust: ['1.63']
steps:
- uses: actions/checkout@v3
- name: Install Rust
Expand Down
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "polling"
version = "2.8.0"
authors = ["Stjepan Glavina <[email protected]>"]
edition = "2018"
rust-version = "1.48"
rust-version = "1.63"
description = "Portable interface to epoll, kqueue, event ports, and IOCP"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/smol-rs/polling"
Expand All @@ -25,15 +25,12 @@ std = []
cfg-if = "1"
log = "0.4.11"

[build-dependencies]
autocfg = "1"

[target.'cfg(any(unix, target_os = "fuchsia", target_os = "vxworks"))'.dependencies]
libc = "0.2.77"
rustix = { version = "0.37.11", features = ["process", "time", "fs", "std"], default-features = false }

[target.'cfg(windows)'.dependencies]
bitflags = "1.3.2"
bitflags = "2"
concurrent-queue = "2.2.0"
pin-project-lite = "0.2.9"

Expand Down
25 changes: 0 additions & 25 deletions build.rs

This file was deleted.

6 changes: 1 addition & 5 deletions src/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::convert::TryInto;
use std::io;
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::time::Duration;

use rustix::fd::OwnedFd;
Expand All @@ -12,9 +12,6 @@ use rustix::time::{
Timespec,
};

#[cfg(not(polling_no_io_safety))]
use std::os::unix::io::{AsFd, BorrowedFd};

use crate::{Event, PollMode};

/// Interface to epoll.
Expand Down Expand Up @@ -232,7 +229,6 @@ impl AsRawFd for Poller {
}
}

#[cfg(not(polling_no_io_safety))]
impl AsFd for Poller {
fn as_fd(&self) -> BorrowedFd<'_> {
self.epoll_fd.as_fd()
Expand Down
2 changes: 1 addition & 1 deletion src/iocp/afd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl AfdPollInfo {
}

bitflags::bitflags! {
#[derive(Default)]
#[derive(Default, Copy, Clone)]
#[repr(transparent)]
pub(super) struct AfdPollMask: u32 {
const RECEIVE = 0x001;
Expand Down
6 changes: 1 addition & 5 deletions src/iocp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,12 @@ use std::collections::hash_map::{Entry, HashMap};
use std::fmt;
use std::io;
use std::marker::PhantomPinned;
use std::os::windows::io::{AsRawHandle, RawHandle, RawSocket};
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, RawHandle, RawSocket};
use std::pin::Pin;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, MutexGuard, RwLock, Weak};
use std::time::{Duration, Instant};

#[cfg(not(polling_no_io_safety))]
use std::os::windows::io::{AsHandle, BorrowedHandle};

/// Macro to lock and ignore lock poisoning.
macro_rules! lock {
($lock_result:expr) => {{
Expand Down Expand Up @@ -419,7 +416,6 @@ impl AsRawHandle for Poller {
}
}

#[cfg(not(polling_no_io_safety))]
impl AsHandle for Poller {
fn as_handle(&self) -> BorrowedHandle<'_> {
unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) }
Expand Down
6 changes: 1 addition & 5 deletions src/kqueue.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
//! Bindings to kqueue (macOS, iOS, tvOS, watchOS, FreeBSD, NetBSD, OpenBSD, DragonFly BSD).
use std::io;
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::time::Duration;

#[cfg(not(polling_no_io_safety))]
use std::os::unix::io::{AsFd, BorrowedFd};

use rustix::fd::OwnedFd;
use rustix::io::{fcntl_setfd, kqueue, Errno, FdFlags};

Expand Down Expand Up @@ -177,7 +174,6 @@ impl AsRawFd for Poller {
}
}

#[cfg(not(polling_no_io_safety))]
impl AsFd for Poller {
fn as_fd(&self) -> BorrowedFd<'_> {
self.kqueue_fd.as_fd()
Expand Down
20 changes: 3 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,18 +573,14 @@ impl Poller {
)]
mod raw_fd_impl {
use crate::Poller;
use std::os::unix::io::{AsRawFd, RawFd};

#[cfg(not(polling_no_io_safety))]
use std::os::unix::io::{AsFd, BorrowedFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};

impl AsRawFd for Poller {
fn as_raw_fd(&self) -> RawFd {
self.poller.as_raw_fd()
}
}

#[cfg(not(polling_no_io_safety))]
impl AsFd for Poller {
fn as_fd(&self) -> BorrowedFd<'_> {
self.poller.as_fd()
Expand All @@ -596,18 +592,14 @@ mod raw_fd_impl {
#[cfg_attr(docsrs, doc(cfg(windows)))]
mod raw_handle_impl {
use crate::Poller;
use std::os::windows::io::{AsRawHandle, RawHandle};

#[cfg(not(polling_no_io_safety))]
use std::os::windows::io::{AsHandle, BorrowedHandle};
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, RawHandle};

impl AsRawHandle for Poller {
fn as_raw_handle(&self) -> RawHandle {
self.poller.as_raw_handle()
}
}

#[cfg(not(polling_no_io_safety))]
impl AsHandle for Poller {
fn as_handle(&self) -> BorrowedHandle<'_> {
self.poller.as_handle()
Expand Down Expand Up @@ -667,11 +659,5 @@ cfg_if! {

#[allow(unused)]
fn unsupported_error(err: impl Into<String>) -> io::Error {
io::Error::new(
#[cfg(not(polling_no_unsupported_error_kind))]
io::ErrorKind::Unsupported,
#[cfg(polling_no_unsupported_error_kind)]
io::ErrorKind::Other,
err.into(),
)
io::Error::new(io::ErrorKind::Unsupported, err.into())
}
6 changes: 1 addition & 5 deletions src/port.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
//! Bindings to event port (illumos, Solaris).
use std::io;
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::time::Duration;

#[cfg(not(polling_no_io_safety))]
use std::os::unix::io::{AsFd, BorrowedFd};

use rustix::fd::OwnedFd;
use rustix::io::{fcntl_getfd, fcntl_setfd, port, FdFlags, PollFlags};

Expand Down Expand Up @@ -116,7 +113,6 @@ impl AsRawFd for Poller {
}
}

#[cfg(not(polling_no_io_safety))]
impl AsFd for Poller {
fn as_fd(&self) -> BorrowedFd<'_> {
self.port_fd.as_fd()
Expand Down

0 comments on commit 5df378f

Please sign in to comment.