Vendor dependencies

This commit is contained in:
2026-08-01 16:11:49 +03:00
parent 7f139a0241
commit 6b5e7f0f8b
29706 changed files with 9575646 additions and 0 deletions
@@ -0,0 +1,9 @@
use axum_macros::FromRequest;
#[derive(FromRequest)]
struct Extractor(#[from_request(via(axum::Extension), via(axum::Extension))] State);
#[derive(Clone)]
struct State;
fn main() {}
@@ -0,0 +1,5 @@
error: `via` specified more than once
--> tests/from_request/fail/double_via_attr.rs:4:55
|
4 | struct Extractor(#[from_request(via(axum::Extension), via(axum::Extension))] State);
| ^^^
@@ -0,0 +1,12 @@
use axum_macros::FromRequest;
#[derive(FromRequest, Clone)]
#[from_request(via(axum::Extension))]
enum Extractor {
Foo {
#[from_request(via(axum::Extension))]
foo: (),
},
}
fn main() {}
@@ -0,0 +1,5 @@
error: `#[from_request(via(...))]` cannot be used inside variants
--> tests/from_request/fail/enum_from_request_ident_in_variant.rs:7:24
|
7 | #[from_request(via(axum::Extension))]
| ^^^
@@ -0,0 +1,10 @@
use axum_macros::FromRequest;
#[derive(FromRequest, Clone)]
#[from_request(via(axum::Extension))]
enum Extractor {
#[from_request(via(axum::Extension))]
Foo,
}
fn main() {}
@@ -0,0 +1,5 @@
error: `#[from_request(via(...))]` cannot be used on variants
--> tests/from_request/fail/enum_from_request_on_variant.rs:6:20
|
6 | #[from_request(via(axum::Extension))]
| ^^^
@@ -0,0 +1,6 @@
use axum_macros::FromRequest;
#[derive(FromRequest, Clone)]
enum Extractor {}
fn main() {}
@@ -0,0 +1,7 @@
error: missing `#[from_request(via(...))]`
--> tests/from_request/fail/enum_no_via.rs:3:10
|
3 | #[derive(FromRequest, Clone)]
| ^^^^^^^^^^^
|
= note: this error originates in the derive macro `FromRequest` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -0,0 +1,6 @@
use axum_macros::FromRequest;
#[derive(FromRequest)]
struct Extractor<T>(Option<T>);
fn main() {}
@@ -0,0 +1,5 @@
error: #[derive(FromRequest)] only supports generics on tuple structs that have exactly one field of the generic type
--> tests/from_request/fail/generic.rs:4:21
|
4 | struct Extractor<T>(Option<T>);
| ^^^^^^^^^
@@ -0,0 +1,11 @@
use axum::{routing::get, Router};
use axum_macros::FromRequest;
#[derive(FromRequest, Clone)]
struct Extractor<T>(T);
async fn foo(_: Extractor<()>) {}
fn main() {
_ = Router::<()>::new().route("/", get(foo));
}
@@ -0,0 +1,24 @@
error: #[derive(FromRequest)] only supports generics when used with #[from_request(via)]
--> tests/from_request/fail/generic_without_via.rs:5:18
|
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:10:44
|
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
|
= note: Consider using `#[axum::debug_handler]` to improve the error message
note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| top_level_handler_fn!(get, 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)
@@ -0,0 +1,12 @@
use axum::{routing::get, Router};
use axum_macros::FromRequest;
#[derive(FromRequest, Clone)]
#[from_request(rejection(Foo))]
struct Extractor<T>(T);
async fn foo(_: Extractor<()>) {}
fn main() {
_ = Router::<()>::new().route("/", get(foo));
}
@@ -0,0 +1,24 @@
error: #[derive(FromRequest)] only supports generics when used with #[from_request(via)]
--> tests/from_request/fail/generic_without_via_rejection.rs:6:18
|
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:11:44
|
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
|
= note: Consider using `#[axum::debug_handler]` to improve the error message
note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| top_level_handler_fn!(get, 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)
@@ -0,0 +1,6 @@
use axum_macros::FromRequest;
#[derive(FromRequest)]
union Extractor {}
fn main() {}
@@ -0,0 +1,11 @@
error: expected `struct` or `enum`
--> tests/from_request/fail/not_enum_or_struct.rs:4:1
|
4 | union Extractor {}
| ^^^^^^^^^^^^^^^^^^
error: unions cannot have zero fields
--> tests/from_request/fail/not_enum_or_struct.rs:4:1
|
4 | union Extractor {}
| ^^^^^^^^^^^^^^^^^^
@@ -0,0 +1,33 @@
use axum::{
extract::rejection::ExtensionRejection,
response::{IntoResponse, Response},
routing::get,
Router,
};
use axum_macros::FromRequest;
fn main() {
let _: Router = Router::new().route("/", get(handler).post(handler_result));
}
async fn handler(_: MyExtractor) {}
async fn handler_result(_: Result<MyExtractor, MyRejection>) {}
#[derive(FromRequest, Clone)]
#[from_request(rejection(MyRejection))]
enum MyExtractor {}
struct MyRejection {}
impl From<ExtensionRejection> for MyRejection {
fn from(_: ExtensionRejection) -> Self {
todo!()
}
}
impl IntoResponse for MyRejection {
fn into_response(self) -> Response {
todo!()
}
}
@@ -0,0 +1,43 @@
error: cannot use `rejection` without `via`
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:18:16
|
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:10:50
|
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
|
= note: Consider using `#[axum::debug_handler]` to improve the error message
note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| top_level_handler_fn!(get, 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
|
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
|
= note: Consider using `#[axum::debug_handler]` to improve the error message
note: required by a bound in `MethodRouter::<S>::post`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
| chained_handler_fn!(post, 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)
@@ -0,0 +1,14 @@
use axum::{extract::FromRequestParts, response::Response};
#[derive(FromRequestParts)]
struct Extractor {
body: String,
}
fn assert_from_request()
where
Extractor: FromRequestParts<(), Rejection = Response>,
{
}
fn main() {}
@@ -0,0 +1,18 @@
error[E0277]: the trait bound `String: FromRequestParts<_>` is not satisfied
--> tests/from_request/fail/parts_extracting_body.rs:5:11
|
5 | body: String,
| ^^^^^^ the trait `FromRequestParts<_>` is not implemented for `String`
|
= note: Function argument is not a valid axum extractor.
See `https://docs.rs/axum/0.8/axum/extract/index.html` for details
= help: the following other types implement trait `FromRequestParts<S>`:
`ConnectInfo<T>` implements `FromRequestParts<S>`
`Extension<T>` implements `FromRequestParts<S>`
`Extractor` implements `FromRequestParts<S>`
`HeaderMap` implements `FromRequestParts<S>`
`MatchedPath` implements `FromRequestParts<S>`
`Method` implements `FromRequestParts<S>`
`OriginalUri` implements `FromRequestParts<S>`
`Query<T>` implements `FromRequestParts<S>`
and $N others
@@ -0,0 +1,22 @@
use axum::extract::State;
use axum_macros::FromRequest;
#[derive(FromRequest)]
struct Extractor {
inner_state: State<AppState>,
other_state: State<OtherState>,
}
#[derive(Clone)]
struct AppState {}
#[derive(Clone)]
struct OtherState {}
fn assert_from_request()
where
Extractor: axum::extract::FromRequest<AppState, Rejection = axum::response::Response>,
{
}
fn main() {}
@@ -0,0 +1,7 @@
error: can't infer state type, please add `#[from_request(state = MyStateType)]` attribute
--> tests/from_request/fail/state_infer_multiple_different_types.rs:4:10
|
4 | #[derive(FromRequest)]
| ^^^^^^^^^^^
|
= note: this error originates in the derive macro `FromRequest` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -0,0 +1,7 @@
use axum_macros::FromRequest;
#[derive(FromRequest)]
#[from_request(foo)]
struct Extractor;
fn main() {}
@@ -0,0 +1,5 @@
error: expected one of: `via`, `rejection`, `state`
--> tests/from_request/fail/unknown_attr_container.rs:4:16
|
4 | #[from_request(foo)]
| ^^^
@@ -0,0 +1,6 @@
use axum_macros::FromRequest;
#[derive(FromRequest)]
struct Extractor(#[from_request(foo)] String);
fn main() {}
@@ -0,0 +1,5 @@
error: expected `via`
--> tests/from_request/fail/unknown_attr_field.rs:4:33
|
4 | struct Extractor(#[from_request(foo)] String);
| ^^^
@@ -0,0 +1,10 @@
use axum_macros::FromRequest;
#[derive(FromRequest)]
#[from_request(via(axum::Extension))]
struct Extractor(#[from_request(via(axum::Extension))] State);
#[derive(Clone)]
struct State;
fn main() {}
@@ -0,0 +1,5 @@
error: `#[from_request(via(...))]` on a field cannot be used together with `#[from_request(...)]` on the container
--> tests/from_request/fail/via_on_container_and_field.rs:5:33
|
5 | struct Extractor(#[from_request(via(axum::Extension))] State);
| ^^^