Skip to content

Commit

Permalink
bump MSRV to 1.85 (edition 2024) + fix all issues that come from it
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenDC committed Feb 20, 2025
1 parent 764b8a6 commit 3bd83fb
Show file tree
Hide file tree
Showing 359 changed files with 1,831 additions and 1,282 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: stable
RUST_TOOLCHAIN_NIGHTLY: nightly
RUST_TOOLCHAIN_MSRV: 1.84.0
RUST_TOOLCHAIN_MSRV: 1.85.0
RUST_TOOLCHAIN_BETA: beta

on:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ just qa

Before you can do this you do require the following to be installed:

* `Rust`, version 1.84 or beyond: <https://www.rust-lang.org/tools/install>
* `Rust`, version 1.85 or beyond: <https://www.rust-lang.org/tools/install>
* `just` (to run _just_ (config) files): <https://just.systems/man/en/packages.html>
* `cargo hack`: <https://github.com/taiki-e/cargo-hack?tab=readme-ov-file#installation>

Once this is all done you should be able to run `just qa`.
When all these pass you can be pretty certain that all tests in the GitHub CI step
will also succeed. The difference still though is that GitHub Action will also run some of these tests on the MSRV (`1.84`) and three platforms in total: MacOS, Linux and Windows.
will also succeed. The difference still though is that GitHub Action will also run some of these tests on the MSRV (`1.85`) and three platforms in total: MacOS, Linux and Windows.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ members = [
[workspace.package]
version = "0.2.0-alpha.7"
license = "MIT OR Apache-2.0"
edition = "2021"
edition = "2024"
repository = "https://github.com/plabayo/rama"
homepage = "https://ramaproxy.org"
keywords = ["io", "async", "non-blocking", "service", "rama"]
categories = ["asynchronous", "network-programming", "web-programming", "web-programming::http-client", "web-programming::http-server"]
authors = ["Glen De Cauwsemaecker <[email protected]>"]
rust-version = "1.84.0"
rust-version = "1.85.0"

[workspace.dependencies]
async-compression = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[license-mit-url]: https://github.com/plabayo/rama/blob/main/LICENSE-MIT
[license-apache-badge]: https://img.shields.io/badge/license-APACHE-blue.svg
[license-apache-url]: https://github.com/plabayo/rama/blob/main/LICENSE-APACHE
[rust-version-badge]: https://img.shields.io/badge/rustc-1.84+-blue?style=flat-square&logo=rust
[rust-version-badge]: https://img.shields.io/badge/rustc-1.85+-blue?style=flat-square&logo=rust
[rust-version-url]: https://www.rust-lang.org
[actions-badge]: https://github.com/plabayo/rama/workflows/CI/badge.svg
[actions-url]: https://github.com/plabayo/rama/actions
Expand Down Expand Up @@ -389,7 +389,7 @@ support as many as we reasonably can.
### Minimum supported Rust version
Rama's MSRV is `1.84`.
Rama's MSRV is `1.85`.
[Using GitHub Actions we also test](https://github.com/plabayo/rama/blob/main/.github/workflows/CI.yml) if `rama` on that version still works on
the stable and beta versions of _rust_ as well.
Expand Down
7 changes: 3 additions & 4 deletions benches/h2.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use rama::http::Request;
use rama::http::core::h2::{
client,
RecvStream, client,
server::{self, SendResponse},
RecvStream,
};
use rama::http::Request;

use bytes::Bytes;
use tokio::net::{TcpListener, TcpStream};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt};

use std::{
error::Error,
Expand Down
2 changes: 1 addition & 1 deletion benches/http_core_body.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![deny(warnings)]

use bytes::Buf;
use futures_util::stream;
use futures_util::StreamExt;
use futures_util::stream;
use rama::http::dep::http_body::Frame;
use rama::http::dep::http_body_util::{BodyExt, StreamBody};

Expand Down
23 changes: 9 additions & 14 deletions benches/http_core_end_to_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl Opts {
Http2(rama::http::core::client::conn::http2::SendRequest<BoxedBody>),
}

let mut client = rt.block_on(async {
let client = rt.block_on(async {
if self.http2 {
let tcp = tokio::net::TcpStream::connect(&addr).await.unwrap();
let (tx, conn) =
Expand Down Expand Up @@ -371,20 +371,15 @@ impl Opts {
req
};

let mut send_request = |req| {
let fut = match client {
Client::Http1(ref mut tx) => {
futures_util::future::Either::Left(tx.send_request(req))
}
Client::Http2(ref mut tx) => {
futures_util::future::Either::Right(tx.send_request(req))
}
let client_ref = &client;

let send_request = async |req| {
let res = match client_ref {
Client::Http1(tx) => tx.send_request(req).await.expect("client wait h1"),
Client::Http2(tx) => tx.send_request(req).await.expect("client wait h2"),
};
async {
let res = fut.await.expect("client wait");
let mut body = res.into_body();
while let Some(_chunk) = body.frame().await {}
}
let mut body = res.into_body();
while let Some(_chunk) = body.frame().await {}
};

let bytes_per_iter = (req_len + self.response_body.len() as u64) * self.parallel_cnt as u64;
Expand Down
2 changes: 1 addition & 1 deletion benches/http_core_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use bytes::Bytes;
use tokio::net::TcpListener;
use tokio::sync::oneshot;

use rama::http::Response;
use rama::http::core::server::conn::http1;
use rama::http::dep::http_body_util::Full;
use rama::http::Response;
use rama::service::service_fn;

#[global_allocator]
Expand Down
2 changes: 1 addition & 1 deletion benches/http_core_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::time::Duration;

use tokio::sync::oneshot;

use rama::http::core::server::conn::http1;
use rama::http::Response;
use rama::http::core::server::conn::http1;
use rama::service::service_fn;

#[global_allocator]
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/crate.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ support as many as we reasonably can.

### Minimum supported Rust version

Rama's MSRV is `1.84`.
Rama's MSRV is `1.85`.

[Using GitHub Actions we also test](https://github.com/plabayo/rama/blob/main/.github/workflows/CI.yml) if `rama` on that version still works on
the stable and beta versions of _rust_ as well.
Expand Down
6 changes: 3 additions & 3 deletions examples/http_conn_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
//! connection index and count of requests within that connection.
use rama::{
http::{response::Html, server::HttpServer, Request},
Context, Layer,
http::{Request, response::Html, server::HttpServer},
layer::MapStateLayer,
rt::Executor,
service::service_fn,
tcp::server::TcpListener,
Context, Layer,
};
use std::{
convert::Infallible,
sync::{
atomic::{AtomicBool, AtomicUsize},
Arc,
atomic::{AtomicBool, AtomicUsize},
},
time::Duration,
};
Expand Down
6 changes: 3 additions & 3 deletions examples/http_connect_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
//! ```
use rama::{
Context, Layer, Service,
context::Extensions,
http::{
Body, IntoResponse, Request, Response, StatusCode,
client::HttpClient,
layer::{
proxy_auth::ProxyAuthLayer,
Expand All @@ -70,7 +72,6 @@ use rama::{
response::Json,
server::HttpServer,
service::web::{extract::Path, match_service},
Body, IntoResponse, Request, Response, StatusCode,
},
layer::HijackLayer,
net::http::RequestContext,
Expand All @@ -82,13 +83,12 @@ use rama::{
username::{
UsernameLabelParser, UsernameLabelState, UsernameLabels, UsernameOpaqueLabelParser,
},
Context, Layer, Service,
};
use serde::Deserialize;
use serde_json::json;
use std::{convert::Infallible, sync::Arc, time::Duration};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt};

#[tokio::main]
async fn main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/http_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@
//! and fill the form in the browser, you should see a response page after submitting the form,
//! stating your name and age.
use rama::Layer;
use rama::http::layer::trace::TraceLayer;
use rama::http::matcher::HttpMatcher;
use rama::http::response::Html;
use rama::http::service::web::{extract::Form, WebService};
use rama::http::service::web::{WebService, extract::Form};
use rama::http::{IntoResponse, Response};
use rama::Layer;
use rama::{http::server::HttpServer, rt::Executor};
use serde::{Deserialize, Serialize};
use std::time::Duration;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt};

#[derive(Serialize, Deserialize, Debug)]
struct Payload {
Expand Down
8 changes: 4 additions & 4 deletions examples/http_high_level_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
// rama provides everything out of the box to build a complete web service.

use rama::{
Context, Layer, Service,
http::{
Body, BodyExtractExt, IntoResponse, Request, Response, StatusCode,
client::HttpClient,
headers::{authorization::Basic, Accept, Authorization, HeaderMapExt},
headers::{Accept, Authorization, HeaderMapExt, authorization::Basic},
layer::{
auth::{AddAuthorizationLayer, AsyncRequireAuthorizationLayer},
compression::CompressionLayer,
Expand All @@ -27,11 +29,9 @@ use rama::{
server::HttpServer,
service::client::HttpClientExt,
service::web::WebService,
Body, BodyExtractExt, IntoResponse, Request, Response, StatusCode,
},
rt::Executor,
utils::{backoff::ExponentialBackoff, rng::HasherRng},
Context, Layer, Service,
};

// Everything else we need is provided by the standard library, community crates or tokio.
Expand All @@ -41,7 +41,7 @@ use std::time::Duration;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::{fmt, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt};

const ADDRESS: &str = "127.0.0.1:62004";

Expand Down
8 changes: 4 additions & 4 deletions examples/http_key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
//! ```
use rama::{
Context, Layer,
http::{
IntoResponse, Method, StatusCode,
layer::{
compression::CompressionLayer, trace::TraceLayer,
validate_request::ValidateRequestHeaderLayer,
Expand All @@ -61,13 +63,11 @@ use rama::{
response::Json,
server::HttpServer,
service::web::{
extract::{Bytes, Path},
IntoEndpointService, WebService,
extract::{Bytes, Path},
},
IntoResponse, Method, StatusCode,
},
rt::Executor,
Context, Layer,
};
use serde::Deserialize;
use serde_json::json;
Expand All @@ -76,7 +76,7 @@ use tokio::sync::RwLock;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::{fmt, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt};

#[derive(Debug, Default)]
struct AppState {
Expand Down
2 changes: 1 addition & 1 deletion examples/http_listener_hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use std::net::{IpAddr, Ipv4Addr};

use rama::{
http::{response::Json, server::HttpServer, Request},
http::{Request, response::Json, server::HttpServer},
rt::Executor,
service::service_fn,
};
Expand Down
8 changes: 4 additions & 4 deletions examples/http_mitm_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
//! ```
use rama::{
Layer, Service,
error::{BoxError, ErrorContext, OpaqueError},
http::{
Body, IntoResponse, Request, Response, StatusCode,
client::HttpClient,
layer::{
map_response_body::MapResponseBodyLayer,
Expand All @@ -53,26 +55,24 @@ use rama::{
},
matcher::MethodMatcher,
server::HttpServer,
Body, IntoResponse, Request, Response, StatusCode,
},
layer::ConsumeErrLayer,
net::http::RequestContext,
net::stream::layer::http::BodyLimitLayer,
net::tls::{
ApplicationProtocol,
client::{ClientConfig, ClientHelloExtension, ServerVerifyMode},
server::{SelfSignedData, ServerAuth, ServerConfig},
ApplicationProtocol,
},
net::user::Basic,
rt::Executor,
service::service_fn,
tcp::server::TcpListener,
tls::std::server::{TlsAcceptorData, TlsAcceptorLayer},
Layer, Service,
};
use std::{convert::Infallible, time::Duration};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt};

#[derive(Debug, Clone)]
struct State {
Expand Down
6 changes: 3 additions & 3 deletions examples/http_rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ use rama::{
combinators::Either,
error::BoxError,
http::{
matcher::HttpMatcher, response::Json, server::HttpServer, HeaderName, HeaderValue,
IntoResponse, Request, Response, StatusCode,
HeaderName, HeaderValue, IntoResponse, Request, Response, StatusCode, matcher::HttpMatcher,
response::Json, server::HttpServer,
},
layer::{
limit::policy::{ConcurrentPolicy, LimitReached},
Layer, LimitLayer, MapResultLayer, TraceErrLayer,
limit::policy::{ConcurrentPolicy, LimitReached},
},
net::stream::matcher::SocketMatcher,
rt::Executor,
Expand Down
2 changes: 1 addition & 1 deletion examples/http_service_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
//! You should see a response with `HTTP/1.1 200 OK` and the content of the `index.html` file.
use rama::{
Layer,
http::{server::HttpServer, service::fs::ServeDir},
layer::TraceErrLayer,
rt::Executor,
tcp::server::TcpListener,
Layer,
};

#[tokio::main]
Expand Down
Loading

0 comments on commit 3bd83fb

Please sign in to comment.