diff --git a/axum-macros/src/lib.rs b/axum-macros/src/lib.rs index 78575390..f4582607 100644 --- a/axum-macros/src/lib.rs +++ b/axum-macros/src/lib.rs @@ -540,6 +540,32 @@ pub fn derive_from_request_parts(item: TokenStream) -> TokenStream { /// } /// ``` /// +/// # Limitations +/// +/// This macro does not work for associated functions — functions defined in an `impl` block that +/// don't take `self`: +/// +/// ```compile_fail +/// use axum::{debug_handler, extract::Path}; +/// +/// struct App {} +/// +/// impl App { +/// #[debug_handler] +/// async fn handler(Path(_): Path) {} +/// } +/// ``` +/// +/// This will yield an error similar to this: +/// +/// ```text +/// error[E0425]: cannot find function `__axum_macros_check_handler_0_from_request_check` in this scope +// --> src/main.rs:xx:xx +// | +// xx | pub async fn handler(Path(_): Path) {} +// | ^^^^ not found in this scope +/// ``` +/// /// # Performance /// /// This macro has no effect when compiled with the release profile. (eg. `cargo build --release`)