From 6fd77f82ca5b0991f4190042d48b871d7d8025e7 Mon Sep 17 00:00:00 2001 From: 3moredays Date: Mon, 9 Feb 2026 17:09:07 +0800 Subject: [PATCH] fix: TypedPath conflicts with OptionalFromRequestParts (#3645) --- axum-macros/CHANGELOG.md | 7 +++++++ axum-macros/src/typed_path.rs | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/axum-macros/CHANGELOG.md b/axum-macros/CHANGELOG.md index 102121e7..23a8cb7f 100644 --- a/axum-macros/CHANGELOG.md +++ b/axum-macros/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# 0.5.1 + +- **fixed:** Fix compilation error when deriving `TypedPath` with + `OptionalFromRequestParts` being in scope ([#3645]) + +[#3645]: https://github.com/tokio-rs/axum/pull/3645 + # 0.5.0 *No changes since alpha.1* diff --git a/axum-macros/src/typed_path.rs b/axum-macros/src/typed_path.rs index 397cc94c..19a7461f 100644 --- a/axum-macros/src/typed_path.rs +++ b/axum-macros/src/typed_path.rs @@ -144,7 +144,8 @@ fn expand_named_fields( parts: &mut ::axum::http::request::Parts, state: &S, ) -> ::std::result::Result { - ::axum::extract::Path::from_request_parts(parts, state) + <::axum::extract::Path<#ident> as ::axum::extract::FromRequestParts> + ::from_request_parts(parts, state) .await .map(|path| path.0) #map_err_rejection