Skip to content

Commit

Permalink
bump MSRV to 1.65 (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Jul 17, 2023
1 parent 177590a commit 8d5d1db
Show file tree
Hide file tree
Showing 60 changed files with 188 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
version:
- 1.60.0
- 1.65.0 # MSRV
- stable

name: ${{ matrix.target.name }} / ${{ matrix.version }}
Expand Down
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
group_imports = "StdExternalCrate"
imports_granularity = "Crate"
use_field_init_shorthand = true
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ members = [
]
resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "1.65"

[patch.crates-io]
actix-codec = { path = "actix-codec" }
actix-macros = { path = "actix-macros" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See example folders for [`actix-server`](./actix-server/examples) and [`actix-tl

## MSRV

Crates in this repo currently have a Minimum Supported Rust Version (MSRV) of 1.60. As a policy, we permit MSRV increases in non-breaking releases.
Crates in this repo currently have a Minimum Supported Rust Version (MSRV) of 1.65. As a policy, we permit MSRV increases in non-breaking releases.

## License

Expand Down
2 changes: 1 addition & 1 deletion actix-codec/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased - 2023-xx-xx

- Minimum supported Rust version (MSRV) is now 1.60.
- Minimum supported Rust version (MSRV) is now 1.65.

## 0.5.1 - 2022-03-15

Expand Down
4 changes: 2 additions & 2 deletions actix-codec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ keywords = ["network", "framework", "async", "futures"]
repository = "https://github.com/actix/actix-net"
categories = ["network-programming", "asynchronous"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.60"
edition.workspace = true
rust-version.workspace = true

[dependencies]
bitflags = "2"
Expand Down
10 changes: 2 additions & 8 deletions actix-codec/src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,7 @@ impl<T, U> Framed<T, U> {
}

/// Flush write buffer to underlying I/O stream.
pub fn flush<I>(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), U::Error>>
pub fn flush<I>(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), U::Error>>
where
T: AsyncWrite,
U: Encoder<I>,
Expand Down Expand Up @@ -270,10 +267,7 @@ impl<T, U> Framed<T, U> {
}

/// Flush write buffer and shutdown underlying I/O stream.
pub fn close<I>(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), U::Error>>
pub fn close<I>(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), U::Error>>
where
T: AsyncWrite,
U: Encoder<I>,
Expand Down
18 changes: 11 additions & 7 deletions actix-codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]

pub use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
pub use tokio_util::{
codec::{Decoder, Encoder},
io::poll_read_buf,
};

mod bcodec;
mod framed;
mod lines;

pub use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
pub use tokio_util::codec::{Decoder, Encoder};
pub use tokio_util::io::poll_read_buf;

pub use self::bcodec::BytesCodec;
pub use self::framed::{Framed, FramedParts};
pub use self::lines::LinesCodec;
pub use self::{
bcodec::BytesCodec,
framed::{Framed, FramedParts},
lines::LinesCodec,
};
5 changes: 1 addition & 4 deletions actix-codec/tests/test_framed_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ impl AsyncWrite for Bilateral {
other => Ready(other),
}
}
fn poll_shutdown(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<Result<(), io::Error>> {
fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
unimplemented!()
}
}
Expand Down
2 changes: 1 addition & 1 deletion actix-macros/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unreleased - 2023-xx-xx

- Update `syn` dependency to `2`.
- Minimum supported Rust version (MSRV) is now 1.60.
- Minimum supported Rust version (MSRV) is now 1.65.

## 0.2.3 - 2021-10-19

Expand Down
4 changes: 2 additions & 2 deletions actix-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ description = "Macros for Actix system and runtime"
repository = "https://github.com/actix/actix-net.git"
categories = ["network-programming", "asynchronous"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.60"
edition.workspace = true
rust-version.workspace = true

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion actix-macros/tests/trybuild.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[rustversion::stable(1.60)] // MSRV
#[rustversion::stable(1.65)] // MSRV
#[test]
fn compile_macros() {
let t = trybuild::TestCases::new();
Expand Down
11 changes: 4 additions & 7 deletions actix-macros/tests/trybuild/main-02-only-async.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
error: the async keyword is missing from the function declaration
--> $DIR/main-02-only-async.rs:2:1
--> tests/trybuild/main-02-only-async.rs:2:1
|
2 | fn main() {
| ^^

error[E0601]: `main` function not found in crate `$CRATE`
--> $DIR/main-02-only-async.rs:1:1
--> tests/trybuild/main-02-only-async.rs:4:2
|
1 | / #[actix_rt::main]
2 | | fn main() {
3 | | futures_util::future::ready(()).await
4 | | }
| |_^ consider adding a `main` function to `$DIR/tests/trybuild/main-02-only-async.rs`
4 | }
| ^ consider adding a `main` function to `$DIR/tests/trybuild/main-02-only-async.rs`
2 changes: 1 addition & 1 deletion actix-rt/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased - 2023-xx-xx

- Minimum supported Rust version (MSRV) is now 1.60.
- Minimum supported Rust version (MSRV) is now 1.65.

## 2.8.0 - 2022-12-21

Expand Down
4 changes: 2 additions & 2 deletions actix-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-net.git"
categories = ["network-programming", "asynchronous"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.60"
edition.workspace = true
rust-version.workspace = true

[features]
default = ["macros"]
Expand Down
3 changes: 1 addition & 2 deletions actix-rt/examples/hyper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ fn main() {
let make_service =
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });

let server =
Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service);
let server = Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service);

if let Err(err) = server.await {
eprintln!("server error: {}", err);
Expand Down
11 changes: 3 additions & 8 deletions actix-rt/src/arbiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ impl Arbiter {
#[allow(clippy::new_without_default)]
pub fn new() -> Arbiter {
Self::with_tokio_rt(|| {
crate::runtime::default_tokio_runtime()
.expect("Cannot create new Arbiter's Runtime.")
crate::runtime::default_tokio_runtime().expect("Cannot create new Arbiter's Runtime.")
})
}

Expand Down Expand Up @@ -149,9 +148,7 @@ impl Arbiter {
.send(SystemCommand::DeregisterArbiter(arb_id));
}
})
.unwrap_or_else(|err| {
panic!("Cannot spawn Arbiter's thread: {:?}. {:?}", &name, err)
});
.unwrap_or_else(|err| panic!("Cannot spawn Arbiter's thread: {name:?}: {err:?}"));

ready_rx.recv().unwrap();

Expand Down Expand Up @@ -201,9 +198,7 @@ impl Arbiter {
.send(SystemCommand::DeregisterArbiter(arb_id));
}
})
.unwrap_or_else(|err| {
panic!("Cannot spawn Arbiter's thread: {:?}. {:?}", &name, err)
});
.unwrap_or_else(|err| panic!("Cannot spawn Arbiter's thread: {name:?}: {err:?}"));

ready_rx.recv().unwrap();

Expand Down
22 changes: 12 additions & 10 deletions actix-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ mod system;
pub use tokio::pin;
use tokio::task::JoinHandle;

pub use self::arbiter::{Arbiter, ArbiterHandle};
pub use self::runtime::Runtime;
pub use self::system::{System, SystemRunner};
pub use self::{
arbiter::{Arbiter, ArbiterHandle},
runtime::Runtime,
system::{System, SystemRunner},
};

pub mod signal {
//! Asynchronous signal handling (Tokio re-exports).
Expand All @@ -89,12 +91,13 @@ pub mod net {
task::{Context, Poll},
};

pub use tokio::io::Ready;
use tokio::io::{AsyncRead, AsyncWrite, Interest};
pub use tokio::net::UdpSocket;
pub use tokio::net::{TcpListener, TcpSocket, TcpStream};
#[cfg(unix)]
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
pub use tokio::{
io::Ready,
net::{TcpListener, TcpSocket, TcpStream, UdpSocket},
};

/// Extension trait over async read+write types that can also signal readiness.
#[doc(hidden)]
Expand Down Expand Up @@ -153,10 +156,9 @@ pub mod net {
pub mod time {
//! Utilities for tracking time (Tokio re-exports).

pub use tokio::time::Instant;
pub use tokio::time::{interval, interval_at, Interval};
pub use tokio::time::{sleep, sleep_until, Sleep};
pub use tokio::time::{timeout, Timeout};
pub use tokio::time::{
interval, interval_at, sleep, sleep_until, timeout, Instant, Interval, Sleep, Timeout,
};
}

pub mod task {
Expand Down
4 changes: 1 addition & 3 deletions actix-rt/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ impl SystemRunner {

/// Runs the event loop until [stopped](System::stop_with_code), returning the exit code.
pub fn run_with_code(self) -> io::Result<i32> {
unimplemented!(
"SystemRunner::run_with_code is not implemented for io-uring feature yet"
);
unimplemented!("SystemRunner::run_with_code is not implemented for io-uring feature yet");
}

/// Runs the provided future, blocking the current thread until the future completes.
Expand Down
2 changes: 1 addition & 1 deletion actix-server/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased - 2023-xx-xx

- Minimum supported Rust version (MSRV) is now 1.60.
- Minimum supported Rust version (MSRV) is now 1.65.

## 2.2.0 - 2022-12-21

Expand Down
6 changes: 3 additions & 3 deletions actix-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ categories = ["network-programming", "asynchronous"]
homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-net.git"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.60"
edition.workspace = true
rust-version.workspace = true

[features]
default = []
Expand All @@ -28,7 +28,7 @@ futures-core = { version = "0.3.17", default-features = false, features = ["allo
futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] }
mio = { version = "0.8", features = ["os-poll", "net"] }
num_cpus = "1.13"
socket2 = "0.4.2" # TODO(MSRV 1.64) update to 0.5
socket2 = "0.5"
tokio = { version = "1.23.1", features = ["sync"] }
tracing = { version = "0.1.30", default-features = false, features = ["log"] }

Expand Down
7 changes: 2 additions & 5 deletions actix-server/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use tracing::{info, trace};
use crate::{
server::ServerCommand,
service::{InternalServiceFactory, ServerServiceFactory, StreamNewService},
socket::{
create_mio_tcp_listener, MioListener, MioTcpListener, StdTcpListener, ToSocketAddrs,
},
socket::{create_mio_tcp_listener, MioListener, MioTcpListener, StdTcpListener, ToSocketAddrs},
worker::ServerWorkerConfig,
Server,
};
Expand Down Expand Up @@ -246,8 +244,7 @@ impl ServerBuilder {
use std::net::{IpAddr, Ipv4Addr};
lst.set_nonblocking(true)?;
let token = self.next_token();
let addr =
crate::socket::StdSocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
let addr = crate::socket::StdSocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
self.factories.push(StreamNewService::create(
name.as_ref().to_string(),
token,
Expand Down
9 changes: 4 additions & 5 deletions actix-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ mod test_server;
mod waker_queue;
mod worker;

pub use self::builder::ServerBuilder;
pub use self::handle::ServerHandle;
pub use self::server::Server;
pub use self::service::ServerServiceFactory;
#[doc(hidden)]
pub use self::socket::FromStream;
pub use self::test_server::TestServer;
pub use self::{
builder::ServerBuilder, handle::ServerHandle, server::Server, service::ServerServiceFactory,
test_server::TestServer,
};

/// Start server building process
#[doc(hidden)]
Expand Down
2 changes: 1 addition & 1 deletion actix-server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ where
Ok(())
}
Err(err) => {
error!("can not convert to an async TCP stream: {}", err);
error!("can not convert to an async TCP stream: {err}");
Err(())
}
})
Expand Down
5 changes: 2 additions & 3 deletions actix-server/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ pub(crate) use mio::net::TcpListener as MioTcpListener;
use mio::{event::Source, Interest, Registry, Token};
#[cfg(unix)]
pub(crate) use {
mio::net::UnixListener as MioUnixListener,
std::os::unix::net::UnixListener as StdUnixListener,
mio::net::UnixListener as MioUnixListener, std::os::unix::net::UnixListener as StdUnixListener,
};

pub(crate) enum MioListener {
Expand Down Expand Up @@ -105,7 +104,7 @@ impl fmt::Debug for MioListener {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
MioListener::Tcp(ref lst) => write!(f, "{:?}", lst),
#[cfg(all(unix))]
#[cfg(unix)]
MioListener::Uds(ref lst) => write!(f, "{:?}", lst),
}
}
Expand Down
Loading

0 comments on commit 8d5d1db

Please sign in to comment.