Skip to content

Commit

Permalink
Make nightly_error_messages feature compatible with latest nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
mladedav authored Mar 14, 2024
1 parent b6b203b commit 3569950
Show file tree
Hide file tree
Showing 18 changed files with 86 additions and 58 deletions.
1 change: 0 additions & 1 deletion axum-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg_attr(nightly_error_messages, feature(diagnostic_namespace))]
//! Core types and traits for [`axum`].
//!
//! Libraries authors that want to provide [`FromRequest`] or [`IntoResponse`] implementations
Expand Down
2 changes: 1 addition & 1 deletion axum-macros/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-09-23
nightly-2024-03-13
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(diagnostic_namespace)]
use axum_macros::debug_handler;

#[debug_handler]
Expand Down
30 changes: 15 additions & 15 deletions axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
error[E0277]: the trait bound `bool: FromRequestParts<()>` is not satisfied
--> tests/debug_handler/fail/argument_not_extractor.rs:5:24
error[E0277]: the trait bound `bool: FromRequest<(), axum_core::extract::private::ViaParts>` is not satisfied
--> tests/debug_handler/fail/argument_not_extractor.rs:4:24
|
5 | async fn handler(_foo: bool) {}
| ^^^^ the trait `FromRequestParts<()>` is not implemented for `bool`
4 | async fn handler(_foo: bool) {}
| ^^^^ the trait `FromRequestParts<()>` is not implemented for `bool`, which is required by `bool: FromRequest<(), _>`
|
= note: Function argument is not a valid axum extractor.
See `https://docs.rs/axum/0.7/axum/extract/index.html` for details
= help: the following other types implement trait `FromRequestParts<S>`:
<HeaderMap as FromRequestParts<S>>
<Extension<T> as FromRequestParts<S>>
<Method as FromRequestParts<S>>
<axum::http::request::Parts as FromRequestParts<S>>
<Uri as FromRequestParts<S>>
<Version as FromRequestParts<S>>
<Extensions as FromRequestParts<S>>
<ConnectInfo<T> as FromRequestParts<S>>
= help: the following other types implement trait `FromRequest<S, M>`:
axum::body::Bytes
Body
Form<T>
Json<T>
axum::http::Request<Body>
RawForm
String
Option<T>
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:5:24
--> tests/debug_handler/fail/argument_not_extractor.rs:4:24
|
5 | async fn handler(_foo: bool) {}
4 | async fn handler(_foo: bool) {}
| ^^^^ required by this bound in `__axum_macros_check_handler_0_from_request_check`
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ use axum_macros::debug_handler;
struct Struct {}

#[debug_handler]
async fn handler(foo: Json<Struct>) {}
async fn handler(_foo: Json<Struct>) {}

fn main() {}
30 changes: 27 additions & 3 deletions axum-macros/tests/debug_handler/fail/json_not_deserialize.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `for<'de> Struct: serde::de::Deserialize<'de>` is not satisfied
--> tests/debug_handler/fail/json_not_deserialize.rs:7:23
--> tests/debug_handler/fail/json_not_deserialize.rs:7:24
|
7 | async fn handler(foo: Json<Struct>) {}
| ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct`
7 | async fn handler(_foo: Json<Struct>) {}
| ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct`, which is required by `Json<Struct>: FromRequest<()>`
|
= help: the following other types implement trait `serde::de::Deserialize<'de>`:
bool
Expand All @@ -18,3 +18,27 @@ error[E0277]: the trait bound `for<'de> Struct: serde::de::Deserialize<'de>` is
= note: required for `Json<Struct>` to implement `FromRequest<()>`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable

error[E0277]: the trait bound `for<'de> Struct: serde::de::Deserialize<'de>` is not satisfied
--> tests/debug_handler/fail/json_not_deserialize.rs:7:24
|
7 | async fn handler(_foo: Json<Struct>) {}
| ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct`, which is required by `Json<Struct>: FromRequest<()>`
|
= help: the following other types implement trait `serde::de::Deserialize<'de>`:
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<()>`
note: required by a bound in `__axum_macros_check_handler_0_from_request_check`
--> tests/debug_handler/fail/json_not_deserialize.rs:7:24
|
7 | async fn handler(_foo: Json<Struct>) {}
| ^^^^^^^^^^^^ required by this bound in `__axum_macros_check_handler_0_from_request_check`
4 changes: 1 addition & 3 deletions axum-macros/tests/debug_handler/fail/not_send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ error: future cannot be sent between threads safely
3 | #[debug_handler]
| ^^^^^^^^^^^^^^^^ future returned by `handler` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future<Output = ()>: Send`
note: future is not `Send` as this value is used across an await
--> tests/debug_handler/fail/not_send.rs:6:14
|
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
7 | }
| - `_rc` is later dropped here
note: required by a bound in `check`
--> tests/debug_handler/fail/not_send.rs:3:1
|
Expand Down
22 changes: 22 additions & 0 deletions axum-macros/tests/debug_handler/fail/wrong_return_tuple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,25 @@ error[E0277]: the trait bound `CustomIntoResponse: IntoResponseParts` is not sat
and $N others
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable

error[E0277]: the trait bound `CustomIntoResponse: IntoResponseParts` is not satisfied
--> tests/debug_handler/fail/wrong_return_tuple.rs:24:5
|
24 | CustomIntoResponse,
| ^^^^^^^^^^^^^^^^^^ the trait `IntoResponseParts` is not implemented for `CustomIntoResponse`
|
= help: the following other types implement trait `IntoResponseParts`:
AppendHeaders<I>
HeaderMap
Extension<T>
Extensions
Option<T>
[(K, V); N]
()
(T1,)
and $N others
note: required by a bound in `__axum_macros_check_custom_type_into_response_parts_1_check`
--> tests/debug_handler/fail/wrong_return_tuple.rs:24:5
|
24 | CustomIntoResponse,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `__axum_macros_check_custom_type_into_response_parts_1_check`
1 change: 0 additions & 1 deletion axum-macros/tests/from_request/fail/generic_without_via.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(diagnostic_namespace)]
use axum::{routing::get, Router};
use axum_macros::FromRequest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: #[derive(FromRequest)] only supports generics when used with #[from_request(via)]
--> tests/from_request/fail/generic_without_via.rs:6:18
--> tests/from_request/fail/generic_without_via.rs:5:18
|
6 | struct Extractor<T>(T);
5 | 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:11:44
--> tests/from_request/fail/generic_without_via.rs:10:44
|
11 | _ = Router::<()>::new().route("/", get(foo));
10 | _ = 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(diagnostic_namespace)]
use axum::{routing::get, Router};
use axum_macros::FromRequest;

Expand Down
Original file line number Diff line number Diff line change
@@ -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:7:18
--> tests/from_request/fail/generic_without_via_rejection.rs:6:18
|
7 | 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_rejection.rs:12:44
--> tests/from_request/fail/generic_without_via_rejection.rs:11:44
|
12 | _ = 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(diagnostic_namespace)]
use axum::{
extract::rejection::ExtensionRejection,
response::{IntoResponse, Response},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: cannot use `rejection` without `via`
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:19:16
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:18:16
|
19 | #[from_request(rejection(MyRejection))]
18 | #[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:11:50
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:50
|
11 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
10 | 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
Expand All @@ -27,9 +27,9 @@ note: required by a bound in `axum::routing::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:11:64
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:64
|
11 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
10 | 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(diagnostic_namespace)]
use axum::{extract::FromRequestParts, response::Response};

#[derive(FromRequestParts)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0277]: the trait bound `String: FromRequestParts<S>` is not satisfied
--> tests/from_request/fail/parts_extracting_body.rs:6:11
--> tests/from_request/fail/parts_extracting_body.rs:5:11
|
6 | body: String,
5 | body: String,
| ^^^^^^ the trait `FromRequestParts<S>` is not implemented for `String`
|
= note: Function argument is not a valid axum extractor.
Expand Down
15 changes: 3 additions & 12 deletions axum-macros/tests/typed_path/fail/not_deserialize.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
error[E0277]: the trait bound `for<'de> MyPath: serde::de::Deserialize<'de>` is not satisfied
error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satisfied
--> tests/typed_path/fail/not_deserialize.rs:3:10
|
3 | #[derive(TypedPath)]
| ^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `MyPath`
| ^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `MyPath`, which is required by `axum::extract::Path<MyPath>: FromRequestParts<S>`
|
= help: the following other types implement trait `serde::de::Deserialize<'de>`:
bool
char
isize
i8
i16
i32
i64
i128
and $N others
= help: the trait `FromRequestParts<S>` is implemented for `axum::extract::Path<T>`
= note: required for `MyPath` to implement `serde::de::DeserializeOwned`
= note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>`
= note: this error originates in the derive macro `TypedPath` (in Nightly builds, run with -Z macro-backtrace for more info)
1 change: 0 additions & 1 deletion axum/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg_attr(nightly_error_messages, feature(diagnostic_namespace))]
//! axum is a web application framework that focuses on ergonomics and modularity.
//!
//! # Table of contents
Expand Down

0 comments on commit 3569950

Please sign in to comment.