From 3569950a2e5a8ccee481a1b7632638a976a0cd7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ml=C3=A1dek?= <david.mladek.cz@gmail.com> Date: Thu, 14 Mar 2024 21:19:03 +0100 Subject: [PATCH] Make nightly_error_messages feature compatible with latest nightly --- axum-core/src/lib.rs | 1 - axum-macros/rust-toolchain | 2 +- .../fail/argument_not_extractor.rs | 1 - .../fail/argument_not_extractor.stderr | 30 +++++++++---------- .../fail/json_not_deserialize.rs | 2 +- .../fail/json_not_deserialize.stderr | 30 +++++++++++++++++-- .../tests/debug_handler/fail/not_send.stderr | 4 +-- .../fail/wrong_return_tuple.stderr | 22 ++++++++++++++ .../from_request/fail/generic_without_via.rs | 1 - .../fail/generic_without_via.stderr | 8 ++--- .../fail/generic_without_via_rejection.rs | 1 - .../fail/generic_without_via_rejection.stderr | 8 ++--- .../override_rejection_on_enum_without_via.rs | 1 - ...rride_rejection_on_enum_without_via.stderr | 12 ++++---- .../fail/parts_extracting_body.rs | 1 - .../fail/parts_extracting_body.stderr | 4 +-- .../typed_path/fail/not_deserialize.stderr | 15 ++-------- axum/src/lib.rs | 1 - 18 files changed, 86 insertions(+), 58 deletions(-) diff --git a/axum-core/src/lib.rs b/axum-core/src/lib.rs index a4dd6cd9..994b522c 100644 --- a/axum-core/src/lib.rs +++ b/axum-core/src/lib.rs @@ -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 diff --git a/axum-macros/rust-toolchain b/axum-macros/rust-toolchain index 2c3dbd2c..b83876b5 100644 --- a/axum-macros/rust-toolchain +++ b/axum-macros/rust-toolchain @@ -1 +1 @@ -nightly-2023-09-23 +nightly-2024-03-13 diff --git a/axum-macros/tests/debug_handler/fail/argument_not_extractor.rs b/axum-macros/tests/debug_handler/fail/argument_not_extractor.rs index 2d386c82..85a4c1d2 100644 --- a/axum-macros/tests/debug_handler/fail/argument_not_extractor.rs +++ b/axum-macros/tests/debug_handler/fail/argument_not_extractor.rs @@ -1,4 +1,3 @@ -#![feature(diagnostic_namespace)] use axum_macros::debug_handler; #[debug_handler] diff --git a/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr b/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr index d9467825..eedccb23 100644 --- a/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr +++ b/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr @@ -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` diff --git a/axum-macros/tests/debug_handler/fail/json_not_deserialize.rs b/axum-macros/tests/debug_handler/fail/json_not_deserialize.rs index d894b0bd..b6be5f87 100644 --- a/axum-macros/tests/debug_handler/fail/json_not_deserialize.rs +++ b/axum-macros/tests/debug_handler/fail/json_not_deserialize.rs @@ -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() {} diff --git a/axum-macros/tests/debug_handler/fail/json_not_deserialize.stderr b/axum-macros/tests/debug_handler/fail/json_not_deserialize.stderr index ee30bfed..14b3ae83 100644 --- a/axum-macros/tests/debug_handler/fail/json_not_deserialize.stderr +++ b/axum-macros/tests/debug_handler/fail/json_not_deserialize.stderr @@ -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 @@ -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` diff --git a/axum-macros/tests/debug_handler/fail/not_send.stderr b/axum-macros/tests/debug_handler/fail/not_send.stderr index 82f5bb2b..13ab83dd 100644 --- a/axum-macros/tests/debug_handler/fail/not_send.stderr +++ b/axum-macros/tests/debug_handler/fail/not_send.stderr @@ -4,7 +4,7 @@ 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 | @@ -12,8 +12,6 @@ note: future is not `Send` as this value is used across an await | --- 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 | diff --git a/axum-macros/tests/debug_handler/fail/wrong_return_tuple.stderr b/axum-macros/tests/debug_handler/fail/wrong_return_tuple.stderr index 5e1eb0ba..812c37ed 100644 --- a/axum-macros/tests/debug_handler/fail/wrong_return_tuple.stderr +++ b/axum-macros/tests/debug_handler/fail/wrong_return_tuple.stderr @@ -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` diff --git a/axum-macros/tests/from_request/fail/generic_without_via.rs b/axum-macros/tests/from_request/fail/generic_without_via.rs index c6b0668a..f0d54acf 100644 --- a/axum-macros/tests/from_request/fail/generic_without_via.rs +++ b/axum-macros/tests/from_request/fail/generic_without_via.rs @@ -1,4 +1,3 @@ -#![feature(diagnostic_namespace)] use axum::{routing::get, Router}; use axum_macros::FromRequest; diff --git a/axum-macros/tests/from_request/fail/generic_without_via.stderr b/axum-macros/tests/from_request/fail/generic_without_via.stderr index 9620e643..60c16256 100644 --- a/axum-macros/tests/from_request/fail/generic_without_via.stderr +++ b/axum-macros/tests/from_request/fail/generic_without_via.stderr @@ -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 diff --git a/axum-macros/tests/from_request/fail/generic_without_via_rejection.rs b/axum-macros/tests/from_request/fail/generic_without_via_rejection.rs index 9b748293..b1ce072c 100644 --- a/axum-macros/tests/from_request/fail/generic_without_via_rejection.rs +++ b/axum-macros/tests/from_request/fail/generic_without_via_rejection.rs @@ -1,4 +1,3 @@ -#![feature(diagnostic_namespace)] use axum::{routing::get, Router}; use axum_macros::FromRequest; diff --git a/axum-macros/tests/from_request/fail/generic_without_via_rejection.stderr b/axum-macros/tests/from_request/fail/generic_without_via_rejection.stderr index ee6739af..9da7b93a 100644 --- a/axum-macros/tests/from_request/fail/generic_without_via_rejection.stderr +++ b/axum-macros/tests/from_request/fail/generic_without_via_rejection.stderr @@ -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 diff --git a/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.rs b/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.rs index 744d31aa..e855d5f6 100644 --- a/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.rs +++ b/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.rs @@ -1,4 +1,3 @@ -#![feature(diagnostic_namespace)] use axum::{ extract::rejection::ExtensionRejection, response::{IntoResponse, Response}, diff --git a/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.stderr b/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.stderr index 41252bc3..b220ab4e 100644 --- a/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.stderr +++ b/axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.stderr @@ -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 @@ -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 diff --git a/axum-macros/tests/from_request/fail/parts_extracting_body.rs b/axum-macros/tests/from_request/fail/parts_extracting_body.rs index 753d92a9..45a93777 100644 --- a/axum-macros/tests/from_request/fail/parts_extracting_body.rs +++ b/axum-macros/tests/from_request/fail/parts_extracting_body.rs @@ -1,4 +1,3 @@ -#![feature(diagnostic_namespace)] use axum::{extract::FromRequestParts, response::Response}; #[derive(FromRequestParts)] diff --git a/axum-macros/tests/from_request/fail/parts_extracting_body.stderr b/axum-macros/tests/from_request/fail/parts_extracting_body.stderr index fbd58ea0..c7c9b201 100644 --- a/axum-macros/tests/from_request/fail/parts_extracting_body.stderr +++ b/axum-macros/tests/from_request/fail/parts_extracting_body.stderr @@ -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. diff --git a/axum-macros/tests/typed_path/fail/not_deserialize.stderr b/axum-macros/tests/typed_path/fail/not_deserialize.stderr index 3ae15fbe..ead04ebc 100644 --- a/axum-macros/tests/typed_path/fail/not_deserialize.stderr +++ b/axum-macros/tests/typed_path/fail/not_deserialize.stderr @@ -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) diff --git a/axum/src/lib.rs b/axum/src/lib.rs index 372a9207..601c14ae 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -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