diff --git a/axum-core/src/lib.rs b/axum-core/src/lib.rs index a4dd6cd969..994b522c07 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 2c3dbd2c7b..b83876b519 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 2d386c82f5..85a4c1d283 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 d946782586..eedccb2317 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`: - > - as FromRequestParts> - > - > - > - > - > - as FromRequestParts> + = help: the following other types implement trait `FromRequest`: + axum::body::Bytes + Body + Form + Json + axum::http::Request + RawForm + String + Option 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 d894b0bd96..b6be5f87d4 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) {} +async fn handler(_foo: Json) {} 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 ee30bfed0d..14b3ae83fa 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) {} - | ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct` +7 | async fn handler(_foo: Json) {} + | ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct`, which is required by `Json: 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` 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) {} + | ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct`, which is required by `Json: 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` 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) {} + | ^^^^^^^^^^^^ 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 82f5bb2b3e..13ab83ddc0 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`, the trait `Send` is not implemented for `Rc<()>` + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future: 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 5e1eb0bae0..812c37edac 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 + HeaderMap + Extension + Extensions + Option + [(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 c6b0668a91..f0d54acfa9 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 9620e64373..60c16256f2 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); +5 | struct Extractor(T); | ^ error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future {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 {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 9b74829348..b1ce072cb4 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 ee6739af63..9da7b93a2f 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); +6 | struct Extractor(T); | ^ error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future {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 {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 744d31aa70..e855d5f65c 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 41252bc3e7..b220ab4eb9 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 {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 {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) -> impl Future {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) -> impl Future {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 753d92a981..45a93777a9 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 fbd58ea013..c7c9b201fe 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` 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` 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 3ae15fbef0..ead04ebcd4 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: FromRequestParts` | - = 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` is implemented for `axum::extract::Path` = note: required for `MyPath` to implement `serde::de::DeserializeOwned` = note: required for `axum::extract::Path` to implement `FromRequestParts` = 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 372a92070b..601c14ae74 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