From 5acf6f7bc2cc49ef40e8eb3833afaa405bcea085 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 19 Nov 2025 11:43:44 -0500 Subject: [PATCH 1/2] tests: downgrade rand back to 0.8 for now Revert "tests: updated rand dependency to v0.9.1 (#763)" This reverts commit 4304e604fc668baf675867d9045145f015f0957e. --- Cargo.toml | 2 +- tests/header_map_fuzz.rs | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 97205378..29ee6c1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ itoa = "1" [dev-dependencies] quickcheck = "1" -rand = "0.9.1" +rand = "0.8.0" serde = "1.0" serde_json = "1.0" doc-comment = "0.3" diff --git a/tests/header_map_fuzz.rs b/tests/header_map_fuzz.rs index e6a43e8d..40db0494 100644 --- a/tests/header_map_fuzz.rs +++ b/tests/header_map_fuzz.rs @@ -2,8 +2,8 @@ use http::header::*; use http::*; use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult}; -use rand::prelude::IndexedRandom; use rand::rngs::StdRng; +use rand::seq::SliceRandom; use rand::{Rng, SeedableRng}; use std::collections::HashMap; @@ -76,12 +76,12 @@ impl Fuzz { let mut steps = vec![]; let mut expect = AltMap::default(); - let num = rng.random_range(5..500); + let num = rng.gen_range(5..500); let weight = Weight { - insert: rng.random_range(1..10), - remove: rng.random_range(1..10), - append: rng.random_range(1..10), + insert: rng.gen_range(1..10), + remove: rng.gen_range(1..10), + append: rng.gen_range(1..10), }; while steps.len() < num { @@ -112,7 +112,7 @@ impl Fuzz { impl Arbitrary for Fuzz { fn arbitrary(_: &mut Gen) -> Self { - Self::new(rand::rng().random()) + Self::new(rand::thread_rng().gen()) } } @@ -130,7 +130,7 @@ impl AltMap { fn gen_action(&mut self, weight: &Weight, rng: &mut StdRng) -> Action { let sum = weight.insert + weight.remove + weight.append; - let mut num = rng.random_range(0..sum); + let mut num = rng.gen_range(0..sum); if num < weight.insert { return self.gen_insert(rng); @@ -180,7 +180,7 @@ impl AltMap { /// Negative numbers weigh finding an existing header higher fn gen_name(&self, weight: i32, rng: &mut StdRng) -> HeaderName { - let mut existing = rng.random_ratio(1, weight.abs() as u32); + let mut existing = rng.gen_ratio(1, weight.abs() as u32); if weight < 0 { existing = !existing; @@ -202,7 +202,7 @@ impl AltMap { if self.map.is_empty() { None } else { - let n = rng.random_range(0..self.map.len()); + let n = rng.gen_range(0..self.map.len()); self.map.keys().nth(n).map(Clone::clone) } } @@ -337,7 +337,7 @@ fn gen_header_name(g: &mut StdRng) -> HeaderName { header::X_XSS_PROTECTION, ]; - if g.random_ratio(1, 2) { + if g.gen_ratio(1, 2) { STANDARD_HEADERS.choose(g).unwrap().clone() } else { let value = gen_string(g, 1, 25); From 83ae384cd0cf91df89ae31805e0310cf1e0038fb Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 19 Nov 2025 10:31:56 -0500 Subject: [PATCH 2/2] chore: bump MSRV to 1.57 Motivation: to improve panic messages in const fns, which without this are a horrible experience for users. As we make more `from_static` constructors usable in a const context, this is worth the increase. We're still able to build on Debian oldstable. --- Cargo.toml | 5 ++--- README.md | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 29ee6c1c..1bc883aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,9 +19,8 @@ A set of types for representing HTTP requests and responses. """ 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" +edition = "2021" +rust-version = "1.57.0" [workspace] members = [ diff --git a/README.md b/README.md index a0090032..ab7425ee 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,9 @@ fn main() { # Supported Rust Versions -This project follows the [Tokio MSRV][msrv] and is currently set to `1.49`. +This project follows the [hyper's MSRV _policy_][msrv], though it can be lower, and is currently set to `1.57`. -[msrv]: https://github.com/tokio-rs/tokio/#supported-rust-versions +[msrv]: https://hyper.rs/contrib/msrv/ # License