Generate correct bound for non-last extractor in #[debug_handler] (#1299)

* Support running a single UI test

* Generate correct `FromRequestParts` bound

* don't depend on itertools
This commit is contained in:
David Pedersen
2022-08-22 15:34:17 +02:00
committed by GitHub
parent be624306f4
commit bb05dea672
9 changed files with 214 additions and 45 deletions
@@ -16,7 +16,10 @@ error[E0277]: the trait bound `bool: FromRequestParts<()>` is not satisfied
and 26 others
= note: required because of the requirements on the impl of `FromRequest<(), Body, axum_core::extract::private::ViaParts>` for `bool`
note: required by a bound in `__axum_macros_check_handler_0_from_request_check`
--> tests/debug_handler/fail/argument_not_extractor.rs:4:23
--> tests/debug_handler/fail/argument_not_extractor.rs:3:1
|
3 | #[debug_handler]
| ^^^^^^^^^^^^^^^^ required by this bound in `__axum_macros_check_handler_0_from_request_check`
4 | async fn handler(foo: bool) {}
| ^^^^ required by this bound in `__axum_macros_check_handler_0_from_request_check`
| ---- required by a bound in this
= note: this error originates in the attribute macro `debug_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -0,0 +1,7 @@
use axum_macros::debug_handler;
use axum::http::Method;
#[debug_handler]
async fn handler(_: String, _: Method) {}
fn main() {}
@@ -0,0 +1,18 @@
error[E0277]: the trait bound `String: FromRequestParts<()>` is not satisfied
--> tests/debug_handler/fail/doesnt_implement_from_request_parts.rs:4:1
|
4 | #[debug_handler]
| ^^^^^^^^^^^^^^^^ the trait `FromRequestParts<()>` is not implemented for `String`
|
= help: the following other types implement trait `FromRequestParts<S>`:
<() as FromRequestParts<S>>
<(T1, T2) as FromRequestParts<S>>
<(T1, T2, T3) as FromRequestParts<S>>
<(T1, T2, T3, T4) as FromRequestParts<S>>
<(T1, T2, T3, T4, T5) as FromRequestParts<S>>
<(T1, T2, T3, T4, T5, T6) as FromRequestParts<S>>
<(T1, T2, T3, T4, T5, T6, T7) as FromRequestParts<S>>
<(T1, T2, T3, T4, T5, T6, T7, T8) as FromRequestParts<S>>
and 26 others
= help: see issue #48214
= note: this error originates in the attribute macro `debug_handler` (in Nightly builds, run with -Z macro-backtrace for more info)