Skip to content

Commit

Permalink
bump msrv to 1.79 (#1039)
Browse files Browse the repository at this point in the history
* bump msrv to 1.78.

* more msrv bump.

* further bump msrv to enable inline const.
  • Loading branch information
fakeshadow authored Jun 25, 2024
1 parent b05e8fa commit 82c3262
Show file tree
Hide file tree
Showing 30 changed files with 118 additions and 86 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- { name: Linux, os: ubuntu-latest }
- { name: macOS, os: macos-latest }
version:
- 1.75
- 1.79
name: http check @ ${{ matrix.target.name }} - ${{ matrix.version }}
runs-on: ${{ matrix.target.os }}

Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- { name: Linux, os: ubuntu-latest }
- { name: macOS, os: macos-latest }
version:
- 1.75
- 1.79
name: client check @ ${{ matrix.target.name }} - ${{ matrix.version }}
runs-on: ${{ matrix.target.os }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# An alternative http library and web framework inspired by hyper

## Minimum Supported Rust Version
- 1.75 [^1]
- 1.79 [^1]

## Motivation
- Less synchronization and thread per core design is used.
Expand Down
8 changes: 4 additions & 4 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ websocket = ["http-ws"]
dangerous = []

[dependencies]
xitca-http = { version = "0.5", default-features = false, features = ["runtime"] }
xitca-io = "0.3.0"
xitca-unsafe-collection = "0.1.1"
xitca-http = { version = "0.6.0", default-features = false, features = ["runtime"] }
xitca-io = "0.4.0"
xitca-unsafe-collection = "0.2.0"

futures-core = { version = "0.3.17", default-features = false }
futures-sink = { version = "0.3.17", default-features = false }
Expand All @@ -56,7 +56,7 @@ async-stream = { version = "0.3", optional = true }
itoa = { version = "1", optional = true }

# tls shared
xitca-tls = { version = "0.3.0", optional = true }
xitca-tls = { version = "0.4.0", optional = true }

# rustls, http3 and dangerous features shared
webpki-roots = { version = "0.26", optional = true }
Expand Down
10 changes: 5 additions & 5 deletions client/src/h1/proto/decode.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use core::mem::MaybeUninit;

use httparse::{ParserConfig, Status};

use super::context::Context;
use xitca_http::{
bytes::BytesMut,
h1::proto::{codec::TransferCoding, error::ProtoError, header::HeaderIndex},
http::{Response, StatusCode, Version},
};
use xitca_unsafe_collection::uninit;

use super::context::Context;

impl<const HEADER_LIMIT: usize> Context<'_, '_, HEADER_LIMIT> {
pub(crate) fn decode_head(
&mut self,
buf: &mut BytesMut,
) -> Result<Option<(Response<()>, TransferCoding)>, ProtoError> {
let mut headers = uninit::uninit_array::<_, HEADER_LIMIT>();
let mut headers = [const { MaybeUninit::uninit() }; HEADER_LIMIT];

let mut parsed = httparse::Response::new(&mut []);

Expand All @@ -32,7 +32,7 @@ impl<const HEADER_LIMIT: usize> Context<'_, '_, HEADER_LIMIT> {
let status = StatusCode::from_u16(parsed.code.unwrap())?;

// record the index of headers from the buffer.
let mut header_idx = uninit::uninit_array::<_, HEADER_LIMIT>();
let mut header_idx = [const { MaybeUninit::uninit() }; HEADER_LIMIT];
let header_idx_slice = HeaderIndex::record(&mut header_idx, buf, parsed.headers);

let headers_len = parsed.headers.len();
Expand Down
9 changes: 8 additions & 1 deletion http/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# unreleased
# unreleased 0.6.0
## Change
- bump MSRV to `1.79`
- update `xitca-io` to `0.4.0`
- update `xitca-router` to `0.3.0`
- update `xitca-service` to `0.2.0`
- update `xitca-tls` to `0.4.0`
- update `xitca-unsafe-collection` to `0.2.0`

# 0.5.0
## Change
Expand Down
14 changes: 7 additions & 7 deletions http/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-http"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
license = "Apache-2.0"
description = "http library for xitca"
Expand Down Expand Up @@ -34,9 +34,9 @@ io-uring = ["xitca-io/runtime-uring", "tokio-uring"]
router = ["xitca-router"]

[dependencies]
xitca-io = "0.3.0"
xitca-service = { version = "0.1", features = ["alloc", "std"] }
xitca-unsafe-collection = { version = "0.1.1", features = ["bytes"] }
xitca-io = "0.4.0"
xitca-service = { version = "0.2.0", features = ["alloc", "std"] }
xitca-unsafe-collection = { version = "0.2.0", features = ["bytes"] }

futures-core = "0.3.17"
http = "1"
Expand All @@ -48,7 +48,7 @@ tracing = { version = "0.1.40", default-features = false }
native-tls = { version = "0.2.7", features = ["alpn"], optional = true }

# tls support shared
xitca-tls = { version = "0.3.0", optional = true }
xitca-tls = { version = "0.4.0", optional = true }

# http/1 support
httparse = { version = "1.8", optional = true }
Expand All @@ -68,7 +68,7 @@ h3-quinn = { version = "0.0.6", optional = true }
tokio = { version = "1.30", features = ["rt", "time"], optional = true }

# util service support
xitca-router = { version = "0.2", optional = true }
xitca-router = { version = "0.3.0", optional = true }

# io-uring support
tokio-uring = { version = "0.4.0", features = ["bytes"], optional = true }
Expand All @@ -78,7 +78,7 @@ socket2 = { version = "0.5.1", features = ["all"] }

[dev-dependencies]
criterion = "0.5"
xitca-server = "0.3"
xitca-server = "0.4"

[[bench]]
name = "h1_decode"
Expand Down
2 changes: 1 addition & 1 deletion http/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# http library for xitca
# http library for xitca
7 changes: 4 additions & 3 deletions http/src/h1/proto/decode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use core::mem::MaybeUninit;

use httparse::Status;
use xitca_unsafe_collection::uninit;

use crate::{
bytes::{Buf, Bytes, BytesMut},
Expand All @@ -25,7 +26,7 @@ impl<D, const MAX_HEADERS: usize> Context<'_, D, MAX_HEADERS> {
buf: &mut BytesMut,
) -> Result<Option<Decoded>, ProtoError> {
let mut req = httparse::Request::new(&mut []);
let mut headers = uninit::uninit_array::<_, MAX_HEADERS>();
let mut headers = [const { MaybeUninit::uninit() }; MAX_HEADERS];

match req.parse_with_uninit_headers(buf, &mut headers)? {
Status::Complete(len) => {
Expand Down Expand Up @@ -58,7 +59,7 @@ impl<D, const MAX_HEADERS: usize> Context<'_, D, MAX_HEADERS> {
};

// record indices of headers from bytes buffer.
let mut header_idx = uninit::uninit_array::<_, MAX_HEADERS>();
let mut header_idx = [const { MaybeUninit::uninit() }; MAX_HEADERS];
let header_idx_slice = HeaderIndex::record(&mut header_idx, buf, req.headers);
let headers_len = req.headers.len();

Expand Down
8 changes: 3 additions & 5 deletions http/src/util/buffered/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use core::{
fmt,
mem::MaybeUninit,
ops::{Deref, DerefMut},
};

use std::io;

use tracing::trace;
use xitca_io::bytes::{Buf, BytesMut};
use xitca_unsafe_collection::{
bytes::{read_buf, BufList, ChunkVectoredUninit},
uninit::uninit_array,
};
use xitca_unsafe_collection::bytes::{read_buf, BufList, ChunkVectoredUninit};

pub use xitca_io::bytes::{BufInterest, BufRead, BufWrite};

Expand Down Expand Up @@ -240,7 +238,7 @@ where
break;
}

let mut buf = uninit_array::<_, BUF_LIST_CNT>();
let mut buf = [const { MaybeUninit::uninit() }; BUF_LIST_CNT];
let slice = queue.chunks_vectored_uninit_into_init(&mut buf);
match io.write_vectored(slice) {
Ok(0) => return write_zero(self.want_write_io()),
Expand Down
11 changes: 11 additions & 0 deletions http/src/util/service/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ where
/// assert_eq!(extract.0, input.as_str());
/// # }
/// ```
#[diagnostic::on_unimplemented(
message = "`{Self}` does not impl FromRequest trait",
label = "handler function arguments must impl FromRequest trait",
note = "consider add `impl FromRequest<_> for {Self}`"
)]
pub trait FromRequest<'a, Req>: Sized {
// Used to construct the type for any lifetime 'b.
type Type<'b>: FromRequest<'b, Req, Error = Self::Error>;
Expand Down Expand Up @@ -155,6 +161,11 @@ from_req_impl! { A, B, C, D, E, F, G, H, I, }

/// Make Response with ownership of Req.
/// The Output type is what returns from [handler_service] function.
#[diagnostic::on_unimplemented(
message = "`{Self}` does not impl Responder trait",
label = "handler function return type must impl Responder trait",
note = "consider add `impl Responder<_> for {Self}`"
)]
pub trait Responder<Req> {
type Response;
type Error;
Expand Down
5 changes: 4 additions & 1 deletion io/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# unreleased
# unreleased 0.4.0
## Change
- bump MSRV to `1.79`
- update `xitca-unsafe-collection` to `0.2.0`

# 0.3.0
## Change
Expand Down
4 changes: 2 additions & 2 deletions io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-io"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "async network io types and traits"
Expand All @@ -19,7 +19,7 @@ runtime-uring = ["tokio-uring"]
quic = ["quinn", "runtime"]

[dependencies]
xitca-unsafe-collection = { version = "0.1", features = ["bytes"] }
xitca-unsafe-collection = { version = "0.2.0", features = ["bytes"] }

bytes = "1.4"

Expand Down
8 changes: 4 additions & 4 deletions postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ quic = ["quinn", "rustls-pemfile", "tls"]
io-uring = ["xitca-io/runtime-uring"]

[dependencies]
xitca-io = { version = "0.3.0", features = ["runtime"] }
xitca-service = "0.1"
xitca-unsafe-collection = { version = "0.1", features = ["bytes"] }
xitca-io = { version = "0.4.0", features = ["runtime"] }
xitca-service = "0.2.0"
xitca-unsafe-collection = { version = "0.2.0", features = ["bytes"] }

fallible-iterator = "0.2"
percent-encoding = "2"
Expand All @@ -29,7 +29,7 @@ tracing = { version = "0.1.40", default-features = false }
# tls
sha2 = { version = "0.10.8", optional = true }
webpki-roots = { version = "0.26", optional = true }
xitca-tls = { version = "0.3.0", optional = true }
xitca-tls = { version = "0.4.0", optional = true }

# quic
quinn = { version = "0.11", features = ["ring"], optional = true }
Expand Down
5 changes: 4 additions & 1 deletion router/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# unreleased 0.2.1
# unreleased 0.3.0
## Change
- bump MSRV to `1.79`

## Fix
- allow catch all matching for route without leading slash. `foo/*` and `foo/*bar` become valid pattern.

Expand Down
4 changes: 2 additions & 2 deletions router/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-router"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
license = "MIT"
description = "router for xitca"
Expand All @@ -10,7 +10,7 @@ authors = ["fakeshadow <[email protected]>"]
readme= "README.md"

[dependencies]
xitca-unsafe-collection = "0.1"
xitca-unsafe-collection = "0.2.0"

[dev-dependencies]
criterion = "0.5"
Expand Down
7 changes: 6 additions & 1 deletion server/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# unreleased
# unreleased 0.4.0
## Change
- bump MSRV to `1.79`
- update `xitca-io` to `0.4.0`
- update `xitca-service` to `0.2.0`
- update `xitca-unsafe-collection` to `0.2.0`

# 0.3.0
## Remove
Expand Down
8 changes: 4 additions & 4 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-server"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "http server for xitca"
Expand All @@ -16,9 +16,9 @@ quic = ["xitca-io/quic"]
io-uring = ["tokio-uring"]

[dependencies]
xitca-io = { version = "0.3.0", features = ["runtime"] }
xitca-service = { version = "0.1", features = ["alloc"] }
xitca-unsafe-collection = "0.1"
xitca-io = { version = "0.4.0", features = ["runtime"] }
xitca-service = { version = "0.2.0", features = ["alloc"] }
xitca-unsafe-collection = "0.2.0"

tracing = { version = "0.1.40", default-features = false }

Expand Down
3 changes: 3 additions & 0 deletions service/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# unreleased 0.2.0
## Change
- bump MSRV to `1.79`
4 changes: 2 additions & 2 deletions service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-service"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "Apache-2.0"
description = "async traits for xitca"
Expand All @@ -14,4 +14,4 @@ alloc = []
std = []

[dev-dependencies]
xitca-unsafe-collection = "0.1"
xitca-unsafe-collection = "0.2.0"
12 changes: 6 additions & 6 deletions test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ io-uring = ["xitca-http/io-uring", "xitca-server/io-uring"]

[dependencies]
xitca-client = { version = "0.1", features = ["http2", "http3", "websocket", "dangerous"] }
xitca-http = { version = "0.5", features = ["http2", "http3"] }
xitca-http = { version = "0.6", features = ["http2", "http3"] }
xitca-codegen = "0.2"
xitca-io = "0.3.0"
xitca-server = { version = "0.3", features = ["quic"] }
xitca-service = "0.1"
xitca-unsafe-collection = "0.1.1"
xitca-web = "0.5"
xitca-io = "0.4.0"
xitca-server = { version = "0.4", features = ["quic"] }
xitca-service = "0.2.0"
xitca-unsafe-collection = "0.2"
xitca-web = "0.6"

http-ws = { version = "0.4", features = ["stream"] }

Expand Down
5 changes: 4 additions & 1 deletion tls/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# unreleased
# unreleased 0.4.0
## Change
- bump MSRV to `1.79`
- update `xitca-io` to `0.4.0`

# 0.3.0
- update `xitca-io` to `0.3.0`
Expand Down
4 changes: 2 additions & 2 deletions tls/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-tls"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "tls utility for xitca"
Expand All @@ -23,7 +23,7 @@ rustls-uring-no-crypto = ["rustls_crate", "xitca-io/runtime-uring"]
rustls-uring = ["rustls_crate/aws-lc-rs", "xitca-io/runtime-uring"]

[dependencies]
xitca-io = { version = "0.3.0", features = ["runtime"] }
xitca-io = { version = "0.4.0", features = ["runtime"] }

openssl = { version = "0.10", optional = true }
rustls_crate = { package = "rustls", version = "0.23", default-features = false, features = ["logging", "std", "tls12"], optional = true }
Loading

0 comments on commit 82c3262

Please sign in to comment.