Use the diagnostic namespace (#2246)

This commit is contained in:
Georg Semmler
2023-09-29 09:25:26 +02:00
committed by GitHub
parent 930e2ab7c1
commit 2f6200dfbd
26 changed files with 126 additions and 109 deletions
@@ -1,3 +1,4 @@
#![feature(diagnostic_namespace)]
use axum::{routing::get, Router};
use axum_macros::FromRequest;
@@ -1,13 +1,13 @@
error: #[derive(FromRequest)] only supports generics when used with #[from_request(via)]
--> tests/from_request/fail/generic_without_via.rs:5:18
--> tests/from_request/fail/generic_without_via.rs:6:18
|
5 | struct Extractor<T>(T);
6 | struct Extractor<T>(T);
| ^
error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {foo}: Handler<_, _>` is not satisfied
--> tests/from_request/fail/generic_without_via.rs:10:44
--> tests/from_request/fail/generic_without_via.rs:11:44
|
10 | _ = Router::<()>::new().route("/", get(foo));
11 | _ = Router::<()>::new().route("/", get(foo));
| --- ^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
| |
| required by a bound introduced by this call
@@ -20,5 +20,8 @@ note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| top_level_handler_fn!(get, GET);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `get`
| ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
| | |
| | required by a bound in this function
| required by this bound in `get`
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,3 +1,4 @@
#![feature(diagnostic_namespace)]
use axum::{routing::get, Router};
use axum_macros::FromRequest;
@@ -1,13 +1,13 @@
error: #[derive(FromRequest)] only supports generics when used with #[from_request(via)]
--> tests/from_request/fail/generic_without_via_rejection.rs:6:18
--> tests/from_request/fail/generic_without_via_rejection.rs:7:18
|
6 | struct Extractor<T>(T);
7 | struct Extractor<T>(T);
| ^
error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {foo}: Handler<_, _>` is not satisfied
--> tests/from_request/fail/generic_without_via_rejection.rs:11:44
--> tests/from_request/fail/generic_without_via_rejection.rs:12:44
|
11 | _ = Router::<()>::new().route("/", get(foo));
12 | _ = Router::<()>::new().route("/", get(foo));
| --- ^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
| |
| required by a bound introduced by this call
@@ -20,5 +20,8 @@ note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| top_level_handler_fn!(get, GET);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `get`
| ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
| | |
| | required by a bound in this function
| required by this bound in `get`
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,3 +1,4 @@
#![feature(diagnostic_namespace)]
use axum::{
extract::rejection::ExtensionRejection,
response::{IntoResponse, Response},
@@ -1,13 +1,13 @@
error: cannot use `rejection` without `via`
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:18:16
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:19:16
|
18 | #[from_request(rejection(MyRejection))]
19 | #[from_request(rejection(MyRejection))]
| ^^^^^^^^^
error[E0277]: the trait bound `fn(MyExtractor) -> impl Future<Output = ()> {handler}: Handler<_, _>` is not satisfied
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:50
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:11:50
|
10 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
11 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
| --- ^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(MyExtractor) -> impl Future<Output = ()> {handler}`
| |
| required by a bound introduced by this call
@@ -20,13 +20,16 @@ note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| top_level_handler_fn!(get, GET);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `get`
| ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
| | |
| | required by a bound in this function
| required by this bound in `get`
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}: Handler<_, _>` is not satisfied
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:64
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:11:64
|
10 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
11 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
| ---- ^^^^^^^^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}`
| |
| required by a bound introduced by this call
@@ -39,5 +42,8 @@ note: required by a bound in `MethodRouter::<S>::post`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| chained_handler_fn!(post, POST);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MethodRouter::<S>::post`
| ^^^^^^^^^^^^^^^^^^^^----^^^^^^^
| | |
| | required by a bound in this associated function
| required by this bound in `MethodRouter::<S>::post`
= note: this error originates in the macro `chained_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,3 +1,4 @@
#![feature(diagnostic_namespace)]
use axum::{extract::FromRequestParts, response::Response};
#[derive(FromRequestParts)]
@@ -1,18 +1,18 @@
error[E0277]: the trait bound `String: FromRequestParts<S>` is not satisfied
--> tests/from_request/fail/parts_extracting_body.rs:5:11
--> tests/from_request/fail/parts_extracting_body.rs:6:11
|
5 | body: String,
6 | body: String,
| ^^^^^^ the trait `FromRequestParts<S>` is not implemented for `String`
|
= note: Function argument is not a valid axum extractor.
See `https://docs.rs/axum/latest/axum/extract/index.html` for details
= 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>>
<Extractor as FromRequestParts<S>>
<HeaderMap as FromRequestParts<S>>
<Extension<T> as FromRequestParts<S>>
<Method as FromRequestParts<S>>
<Uri as FromRequestParts<S>>
<Version as FromRequestParts<S>>
<ConnectInfo<T> as FromRequestParts<S>>
<axum::extract::Path<T> as FromRequestParts<S>>
and $N others