From c9a120ebd21dd031c829a801a52a6b3719748512 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:27:58 +0000 Subject: [PATCH 1/3] Update Rust to v1.82.0 --- backend.Dockerfile | 2 +- rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend.Dockerfile b/backend.Dockerfile index 51147f9dc57..dad62ad65a5 100644 --- a/backend.Dockerfile +++ b/backend.Dockerfile @@ -1,5 +1,5 @@ # renovate: datasource=github-tags depName=rust lookupName=rust-lang/rust -ARG RUST_VERSION=1.81.0 +ARG RUST_VERSION=1.82.0 FROM rust:$RUST_VERSION diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1de01fa45c4..2e2b8c8521e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.81.0" +channel = "1.82.0" From 5b36494131beb24fbbbb29a73a9febb7a45285b3 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 18 Oct 2024 09:10:39 +0000 Subject: [PATCH 2/3] Replace `PanicInfo` with `PanicInfoHook` --- crates/crates_io_worker/src/util.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/crates_io_worker/src/util.rs b/crates/crates_io_worker/src/util.rs index d8e3b7d498d..b960b1fbc8f 100644 --- a/crates/crates_io_worker/src/util.rs +++ b/crates/crates_io_worker/src/util.rs @@ -2,7 +2,7 @@ use anyhow::anyhow; use sentry_core::Hub; use std::any::Any; use std::future::Future; -use std::panic::PanicInfo; +use std::panic::PanicHookInfo; pub async fn with_sentry_transaction( transaction_name: &str, @@ -34,11 +34,11 @@ where /// Try to figure out what's in the box, and print it if we can. /// /// The actual error type we will get from `panic::catch_unwind` is really poorly documented. -/// However, the `panic::set_hook` functions deal with a `PanicInfo` type, and its payload is +/// However, the `panic::set_hook` functions deal with a `PanicHookInfo` type, and its payload is /// documented as "commonly but not always `&'static str` or `String`". So we can try all of those, /// and give up if we didn't get one of those three types. pub fn try_to_extract_panic_info(info: &(dyn Any + Send + 'static)) -> anyhow::Error { - if let Some(x) = info.downcast_ref::>() { + if let Some(x) = info.downcast_ref::>() { anyhow!("job panicked: {x}") } else if let Some(x) = info.downcast_ref::<&'static str>() { anyhow!("job panicked: {x}") From 6bb0a58575902be31e76b360883005d4d0fdc832 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 18 Oct 2024 09:11:58 +0000 Subject: [PATCH 3/3] Simplify "irrefutable `if let` pattern" --- src/middleware/static_or_continue.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/middleware/static_or_continue.rs b/src/middleware/static_or_continue.rs index 15dca8a694d..10f1075e26e 100644 --- a/src/middleware/static_or_continue.rs +++ b/src/middleware/static_or_continue.rs @@ -25,10 +25,9 @@ async fn serve>(path: P, request: Request, next: Next) -> Respons *static_req.headers_mut() = request.headers().clone(); let serve_dir = ServeDir::new(path).precompressed_br().precompressed_gzip(); - if let Ok(response) = serve_dir.oneshot(static_req).await { - if response.status() != StatusCode::NOT_FOUND { - return response.map(axum::body::Body::new); - } + let Ok(response) = serve_dir.oneshot(static_req).await; + if response.status() != StatusCode::NOT_FOUND { + return response.map(axum::body::Body::new); } }