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,6 +1,7 @@
#![feature(diagnostic_namespace)]
use axum_macros::debug_handler;
#[debug_handler]
async fn handler(foo: bool) {}
async fn handler(_foo: bool) {}
fn main() {}
@@ -1,24 +1,24 @@
error[E0277]: the trait bound `bool: FromRequestParts<()>` is not satisfied
--> tests/debug_handler/fail/argument_not_extractor.rs:4:23
--> tests/debug_handler/fail/argument_not_extractor.rs:5:24
|
4 | async fn handler(foo: bool) {}
| ^^^^ the trait `FromRequestParts<()>` is not implemented for `bool`
5 | async fn handler(_foo: bool) {}
| ^^^^ the trait `FromRequestParts<()>` is not implemented for `bool`
|
= 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>>
<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>>
<RawPathParams as FromRequestParts<S>>
and $N others
= note: required for `bool` to implement `FromRequest<(), axum_core::extract::private::ViaParts>`
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:5:24
|
4 | async fn handler(foo: bool) {}
| ^^^^ required by this bound in `__axum_macros_check_handler_0_from_request_check`
5 | async fn handler(_foo: bool) {}
| ^^^^ required by this bound in `__axum_macros_check_handler_0_from_request_check`
@@ -1,6 +1,6 @@
use axum_macros::debug_handler;
#[debug_handler]
async fn handler<T>(extract: T) {}
async fn handler<T>(_extract: T) {}
fn main() {}
@@ -1,5 +1,5 @@
error: `#[axum_macros::debug_handler]` doesn't support generic functions
--> tests/debug_handler/fail/generics.rs:4:17
|
4 | async fn handler<T>(extract: T) {}
4 | async fn handler<T>(_extract: T) {}
| ^^^
@@ -5,14 +5,14 @@ error[E0277]: the trait bound `for<'de> Struct: serde::de::Deserialize<'de>` is
| ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct`
|
= help: the following other types implement trait `serde::de::Deserialize<'de>`:
&'a [u8]
&'a serde_json::raw::RawValue
&'a std::path::Path
&'a str
()
(T0, T1)
(T0, T1, T2)
(T0, T1, T2, T3)
bool
char
isize
i8
i16
i32
i64
i128
and $N others
= note: required for `Struct` to implement `serde::de::DeserializeOwned`
= note: required for `Json<Struct>` to implement `FromRequest<()>`
@@ -2,7 +2,7 @@ use axum_macros::debug_handler;
#[debug_handler]
async fn handler() {
let rc = std::rc::Rc::new(());
let _rc = std::rc::Rc::new(());
async {}.await;
}
@@ -6,14 +6,14 @@ error: future cannot be sent between threads safely
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
--> tests/debug_handler/fail/not_send.rs:6:13
--> tests/debug_handler/fail/not_send.rs:6:14
|
5 | let rc = std::rc::Rc::new(());
| -- has type `Rc<()>` which is not `Send`
5 | let _rc = std::rc::Rc::new(());
| --- has type `Rc<()>` which is not `Send`
6 | async {}.await;
| ^^^^^^ await occurs here, with `rc` maybe used later
| ^^^^^ await occurs here, with `_rc` maybe used later
7 | }
| - `rc` is later dropped here
| - `_rc` is later dropped here
note: required by a bound in `check`
--> tests/debug_handler/fail/not_send.rs:3:1
|
@@ -3,23 +3,23 @@ use axum::http::Uri;
#[debug_handler]
async fn handler(
e1: Uri,
e2: Uri,
e3: Uri,
e4: Uri,
e5: Uri,
e6: Uri,
e7: Uri,
e8: Uri,
e9: Uri,
e10: Uri,
e11: Uri,
e12: Uri,
e13: Uri,
e14: Uri,
e15: Uri,
e16: Uri,
e17: Uri,
_e1: Uri,
_e2: Uri,
_e3: Uri,
_e4: Uri,
_e5: Uri,
_e6: Uri,
_e7: Uri,
_e8: Uri,
_e9: Uri,
_e10: Uri,
_e11: Uri,
_e12: Uri,
_e13: Uri,
_e14: Uri,
_e15: Uri,
_e16: Uri,
_e17: Uri,
) {}
fn main() {}
@@ -1,11 +1,11 @@
error: Handlers cannot take more than 16 arguments. Use `(a, b): (ExtractorA, ExtractorA)` to further nest extractors
--> tests/debug_handler/fail/too_many_extractors.rs:6:5
|
6 | / e1: Uri,
7 | | e2: Uri,
8 | | e3: Uri,
9 | | e4: Uri,
6 | / _e1: Uri,
7 | | _e2: Uri,
8 | | _e3: Uri,
9 | | _e4: Uri,
... |
21 | | e16: Uri,
22 | | e17: Uri,
| |_____________^
21 | | _e16: Uri,
22 | | _e17: Uri,
| |______________^
@@ -5,14 +5,14 @@ error[E0277]: the trait bound `bool: IntoResponse` is not satisfied
| ^^^^ the trait `IntoResponse` is not implemented for `bool`
|
= help: the following other types implement trait `IntoResponse`:
&'static [u8; N]
&'static [u8]
&'static str
()
(R,)
(Response<()>, R)
(Response<()>, T1, R)
(Response<()>, T1, T2, R)
Box<str>
Box<[u8]>
axum::body::Bytes
Body
axum::extract::rejection::FailedToBufferBody
axum::extract::rejection::LengthLimitError
axum::extract::rejection::UnknownBodyError
axum::extract::rejection::InvalidUtf8
and $N others
note: required by a bound in `__axum_macros_check_handler_into_response::{closure#0}::check`
--> tests/debug_handler/fail/wrong_return_type.rs:4:23