Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump MSRV to 1.70 #731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ keywords = ["http"]
categories = ["web-programming"]
edition = "2018"
# When updating this value, don't forget to also adjust the GitHub Actions config.
rust-version = "1.49.0"
rust-version = "1.70.0"

[workspace]
members = [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn main() {

# Supported Rust Versions

This project follows the [Tokio MSRV][msrv] and is currently set to `1.49`.
This project follows the [Tokio MSRV][msrv] and is currently set to `1.70`.

[msrv]: https://github.com/tokio-rs/tokio/#supported-rust-versions

Expand Down
29 changes: 1 addition & 28 deletions src/header/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,27 +1205,6 @@ impl HeaderName {
///
/// This function panics when the static string is a invalid header.
///
/// Until [Allow panicking in constants](https://github.com/rust-lang/rfcs/pull/2345)
/// makes its way into stable, the panic message at compile-time is
/// going to look cryptic, but should at least point at your header value:
///
/// ```text
/// error: any use of this value will cause an error
/// --> http/src/header/name.rs:1241:13
/// |
/// 1241 | ([] as [u8; 0])[0]; // Invalid header name
/// | ^^^^^^^^^^^^^^^^^^
/// | |
/// | index out of bounds: the length is 0 but the index is 0
/// | inside `http::HeaderName::from_static` at http/src/header/name.rs:1241:13
/// | inside `INVALID_NAME` at src/main.rs:3:34
/// |
/// ::: src/main.rs:3:1
/// |
/// 3 | const INVALID_NAME: HeaderName = HeaderName::from_static("Capitalized");
/// | ------------------------------------------------------------------------
/// ```
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1272,13 +1251,7 @@ impl HeaderName {
i += 1;
}
} {
// TODO: When msrv is bumped to larger than 1.57, this should be
// replaced with `panic!` macro.
// https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html#panic-in-const-contexts
//
// See the panics section of this method's document for details.
#[allow(clippy::no_effect, clippy::out_of_bounds_indexing)]
([] as [u8; 0])[0]; // Invalid header name
panic!("Invalid header name");
}

HeaderName {
Expand Down
29 changes: 1 addition & 28 deletions src/header/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ impl HeaderValue {
/// This function panics if the argument contains invalid header value
/// characters.
///
/// Until [Allow panicking in constants](https://github.com/rust-lang/rfcs/pull/2345)
/// makes its way into stable, the panic message at compile-time is
/// going to look cryptic, but should at least point at your header value:
///
/// ```text
/// error: any use of this value will cause an error
/// --> http/src/header/value.rs:67:17
/// |
/// 67 | ([] as [u8; 0])[0]; // Invalid header value
/// | ^^^^^^^^^^^^^^^^^^
/// | |
/// | index out of bounds: the length is 0 but the index is 0
/// | inside `HeaderValue::from_static` at http/src/header/value.rs:67:17
/// | inside `INVALID_HEADER` at src/main.rs:73:33
/// |
/// ::: src/main.rs:73:1
/// |
/// 73 | const INVALID_HEADER: HeaderValue = HeaderValue::from_static("жsome value");
/// | ----------------------------------------------------------------------------
/// ```
///
/// # Examples
///
/// ```
Expand All @@ -86,13 +65,7 @@ impl HeaderValue {
let mut i = 0;
while i < bytes.len() {
if !is_visible_ascii(bytes[i]) {
// TODO: When msrv is bumped to larger than 1.57, this should be
// replaced with `panic!` macro.
// https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html#panic-in-const-contexts
//
// See the panics section of this method's document for details.
#[allow(clippy::no_effect, clippy::out_of_bounds_indexing)]
([] as [u8; 0])[0]; // Invalid header value
panic!("Invalid header value");
}
i += 1;
}
Expand Down