bump msrv to 1.84

This commit is contained in:
Fei Deng
2025-11-07 14:33:27 -05:00
committed by Matthew (mbg)
parent 4590c6f473
commit 4e343c6d28
15 changed files with 19 additions and 22 deletions
+2 -2
View File
@@ -61,9 +61,9 @@ Both x86_64 and aarch64 architectures will be supported.
Pingora keeps a rolling MSRV (minimum supported Rust version) policy of 6 months. This means we will accept PRs that upgrade the MSRV as long as the new Rust version used is at least 6 months old.
Our current MSRV is effectively 1.83.
Our current MSRV is 1.84.
Previously Pingora advertised an MSRV of 1.72. Older Rust versions may still be able to compile via `cargo update` pinning dependencies such as `backtrace@0.3.74`. The advertised MSRV in config files will be officially bumped to 1.83 in an upcoming release.
Building with the optional feature `boringssl` with Boring >= 4.14 requires Rust 1.80.
## Build Requirements
+1 -1
View File
@@ -1 +1 @@
msrv = "1.72"
msrv = "1.84"
+1 -1
View File
@@ -265,7 +265,7 @@ where
Err(e) => {
return Poll::Ready(Err(e
.into_io_error()
.unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e))));
.unwrap_or_else(|e| io::Error::other(e))));
}
}
+1 -1
View File
@@ -124,7 +124,7 @@ impl Manager {
if self.used.load(Ordering::Relaxed) <= self.limit
&& self
.items_watermark
.map_or(true, |w| self.items.load(Ordering::Relaxed) <= w)
.is_none_or(|w| self.items.load(Ordering::Relaxed) <= w)
{
return vec![];
}
+1 -1
View File
@@ -89,7 +89,7 @@ pub fn calculate_fresh_until(
if authorization_present {
let uncacheable = cache_control
.as_ref()
.map_or(true, |cc| !cc.allow_caching_authorized_req());
.is_none_or(|cc| !cc.allow_caching_authorized_req());
if uncacheable {
return None;
}
+1 -1
View File
@@ -103,7 +103,7 @@ where
pub fn new(shard_capacity: usize) -> Self {
use std::num::NonZeroUsize;
// safe, 1 != 0
const ONE: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(1) };
const ONE: NonZeroUsize = NonZeroUsize::new(1).unwrap();
let mut cache = ConcurrentLruCache {
lrus: Default::default(),
};
+1 -1
View File
@@ -688,7 +688,7 @@ impl HttpCache {
self.inner_mut()
.max_file_size_tracker
.as_mut()
.map_or(true, |t| t.add_body_bytes(bytes_len))
.is_none_or(|t| t.add_body_bytes(bytes_len))
}
/// Check if the max file size has been exceeded according to max file size tracker.
+1 -1
View File
@@ -100,7 +100,7 @@ where
// We assume no peer option == no ALPN == h1 only
let h1_only = peer
.get_peer_options()
.map_or(true, |o| o.alpn.get_max_http_version() == 1);
.is_none_or(|o| o.alpn.get_max_http_version() == 1);
if h1_only {
let (h1, reused) = self.h1.get_http_session(peer).await?;
Ok((HttpSession::H1(h1), reused))
+1 -1
View File
@@ -270,7 +270,7 @@ impl Connector {
if peer.tls()
|| peer
.get_peer_options()
.map_or(true, |o| o.alpn.get_min_http_version() == 1)
.is_none_or(|o| o.alpn.get_min_http_version() == 1)
{
return Ok(HttpSession::H1(Http1Session::new(stream)));
}
@@ -222,12 +222,11 @@ impl HttpSession {
/// Read the request body. `Ok(None)` when there is no (more) body to read.
pub async fn read_body_bytes(&mut self) -> Result<Option<Bytes>> {
let read = self.read_body().await?;
Ok(read.map(|b| {
Ok(read.inspect(|b| {
self.body_bytes_read += b.len();
if let Some(buffer) = self.retry_buffer.as_mut() {
buffer.write_to_buffer(&b);
buffer.write_to_buffer(b);
}
b
}))
}
@@ -554,7 +553,7 @@ impl HttpSession {
// just consume empty body or done messages, the downstream channel is not a real
// connection and only used for this one request
while matches!(&task, HttpTask::Done)
|| matches!(&task, HttpTask::Body(b, _) if b.as_ref().map_or(true, |b| b.is_empty()))
|| matches!(&task, HttpTask::Body(b, _) if b.as_ref().is_none_or(|b| b.is_empty()))
{
task = rx
.recv()
+1 -2
View File
@@ -154,8 +154,7 @@ fn get_opt_sized<T>(sock: c_int, opt: c_int, val: c_int) -> io::Result<T> {
get_opt(sock, opt, val, &mut payload, &mut size)?;
if size != expected_size {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
return Err(std::io::Error::other(
"get_opt size mismatch",
));
}
+1 -2
View File
@@ -238,8 +238,7 @@ impl std::net::ToSocketAddrs for SocketAddr {
if let Some(inet) = self.as_inet() {
Ok(std::iter::once(*inet))
} else {
Err(std::io::Error::new(
std::io::ErrorKind::Other,
Err(std::io::Error::other(
"UDS socket cannot be used as inet socket",
))
}
+1 -1
View File
@@ -264,7 +264,7 @@ where
if matches!(e.etype, H2Downgrade | InvalidH2) {
if peer
.get_alpn()
.map_or(true, |alpn| alpn.get_min_http_version() == 1)
.is_none_or(|alpn| alpn.get_min_http_version() == 1)
{
// Add the peer to prefer h1 so that all following requests
// will use h1
+2 -2
View File
@@ -156,7 +156,7 @@ where
session.cache.cache_found(meta, handler, hit_status);
}
if hit_status_opt.map_or(true, HitStatus::is_treated_as_miss) {
if hit_status_opt.is_none_or(HitStatus::is_treated_as_miss) {
// cache miss
if session.cache.is_cache_locked() {
// Another request is filling the cache; try waiting til that's done and retry.
@@ -406,7 +406,7 @@ where
return (false, Some(e));
}
if !end && body.as_ref().map_or(true, |b| b.is_empty()) {
if !end && body.as_ref().is_none_or(|b| b.is_empty()) {
// Don't write empty body which will end session,
// still more hit handler bytes to read
continue;
+1 -1
View File
@@ -696,7 +696,7 @@ impl ProxyHttp for ExampleProxyCache {
error: Option<&Error>, // None when it is called during stale while revalidate
) -> bool {
// enable serve stale while updating
error.map_or(true, |e| e.esource() == &ErrorSource::Upstream)
error.is_none_or(|e| e.esource() == &ErrorSource::Upstream)
}
fn is_purge(&self, session: &Session, _ctx: &Self::CTX) -> bool {