Skip to content

Commit

Permalink
Bump MSRV to 1.63 (#8)
Browse files Browse the repository at this point in the history
This makes it so `AsFd` implementations are enabled unconditionally.
Removes the build script.
  • Loading branch information
notgull authored Jun 11, 2023
1 parent 6e52d9a commit 4535655
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: cargo check -Z features=dev_dep
- run: cargo test
- name: Force tests with pipe implementation
if : startsWith(matrix.os, 'ubuntu-latest')
if: startsWith(matrix.os, 'ubuntu-latest')
run: cargo test
env:
RUSTFLAGS: --cfg async_signal_force_pipe_impl
Expand All @@ -42,7 +42,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
# When updating this, the reminder to update the minimum supported
# Rust version in Cargo.toml and .clippy.toml.
rust: ['1.48']
rust: ['1.63']
steps:
- uses: actions/checkout@v3
- name: Install Rust
Expand Down
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "async-signal"
version = "0.2.0"
edition = "2018"
authors = ["John Nunley <[email protected]>"]
rust-version = "1.48"
rust-version = "1.63"
description = "Async signal handling"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/smol-rs/async-signal"
Expand Down Expand Up @@ -34,6 +34,3 @@ concurrent-queue = "2.2.0"
async-io = "1.12.0"
futures-lite = "1.12.0"
signal-hook = "0.3.14"

[build-dependencies]
autocfg = "1.1.0"
17 changes: 0 additions & 17 deletions build.rs

This file was deleted.

4 changes: 2 additions & 2 deletions examples/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
async_io::block_on(async {
// Register the signals we want to receive.
#[cfg(unix)]
let signals = Signals::new(&[
let signals = Signals::new([
Signal::Term,
Signal::Quit,
Signal::Int,
Expand All @@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
])?;

#[cfg(windows)]
let signals = Signals::new(&[Signal::Int])?;
let signals = Signals::new([Signal::Int])?;

// Loop over the signals.
signals
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ use std::pin::Pin;
use std::task::{Context, Poll};

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

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

#[cfg(windows)]
mod libc {
Expand Down Expand Up @@ -380,7 +377,7 @@ impl AsRawFd for Signals {
}
}

#[cfg(all(unix, not(async_signal_no_io_safety)))]
#[cfg(unix)]
impl AsFd for Signals {
fn as_fd(&self) -> BorrowedFd<'_> {
self.notifier.as_fd()
Expand Down
6 changes: 1 addition & 5 deletions src/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ use futures_io::AsyncRead;

use std::io::{self, prelude::*};
use std::mem;
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::os::unix::net::UnixStream;
use std::pin::Pin;
use std::task::{Context, Poll};

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

const BUFFER_LEN: usize = mem::size_of::<libc::c_int>();

/// The notifier that uses an asynchronous pipe.
Expand Down Expand Up @@ -101,7 +98,6 @@ impl AsRawFd for Notifier {
}
}

#[cfg(not(async_signal_no_io_safety))]
impl AsFd for Notifier {
fn as_fd(&self) -> BorrowedFd<'_> {
self.read.as_fd()
Expand Down
7 changes: 1 addition & 6 deletions src/signalfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ use concurrent_queue::ConcurrentQueue;
use std::fmt;
use std::io;
use std::mem;
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::sync::Arc;
use std::task::{Context, Poll};

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

const MAX_SIGNALS: usize = 16;

/// The notifier that uses Linux's signalfd API.
Expand Down Expand Up @@ -140,7 +137,6 @@ impl AsRawFd for Notifier {
}
}

#[cfg(not(async_signal_no_io_safety))]
impl AsFd for Notifier {
fn as_fd(&self) -> BorrowedFd<'_> {
self.fd.as_fd()
Expand Down Expand Up @@ -197,7 +193,6 @@ impl AsRawFd for Signalfd {
}
}

#[cfg(not(async_signal_no_io_safety))]
impl AsFd for Signalfd {
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(self.0) }
Expand Down

0 comments on commit 4535655

Please sign in to comment.