Skip to content

Commit 1be6236

Browse files
committed
Use a nightly compiler to run the axum-marcos compile fail tests
1 parent e8ad687 commit 1be6236

11 files changed

+36
-18
lines changed

axum-macros/rust-toolchain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly-2022-10-20

axum-macros/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ where
661661

662662
#[cfg(test)]
663663
fn run_ui_tests(directory: &str) {
664-
#[rustversion::stable]
664+
#[rustversion::nightly]
665665
fn go(directory: &str) {
666666
let t = trybuild::TestCases::new();
667667

@@ -687,8 +687,8 @@ fn run_ui_tests(directory: &str) {
687687
}
688688
}
689689

690-
#[rustversion::not(stable)]
691-
fn go(directory: &str) {}
690+
#[rustversion::not(nightly)]
691+
fn go(_directory: &str) {}
692692

693693
go(directory);
694694
}

axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ error[E0277]: the trait bound `bool: FromRequestParts<()>` is not satisfied
44
4 | async fn handler(foo: bool) {}
55
| ^^^^ the trait `FromRequestParts<()>` is not implemented for `bool`
66
|
7+
= note: Function argument is no valid axum extractor.
8+
See `https://docs.rs/axum/latest/axum/extract/index.html` for details
79
= help: the following other types implement trait `FromRequestParts<S>`:
810
<() as FromRequestParts<S>>
911
<(T1, T2) as FromRequestParts<S>>
@@ -14,7 +16,7 @@ error[E0277]: the trait bound `bool: FromRequestParts<()>` is not satisfied
1416
<(T1, T2, T3, T4, T5, T6, T7) as FromRequestParts<S>>
1517
<(T1, T2, T3, T4, T5, T6, T7, T8) as FromRequestParts<S>>
1618
and 25 others
17-
= note: required because of the requirements on the impl of `FromRequest<(), Body, axum_core::extract::private::ViaParts>` for `bool`
19+
= note: required for `bool` to implement `FromRequest<(), Body, axum_core::extract::private::ViaParts>`
1820
note: required by a bound in `__axum_macros_check_handler_0_from_request_check`
1921
--> tests/debug_handler/fail/argument_not_extractor.rs:4:23
2022
|

axum-macros/tests/debug_handler/fail/doesnt_implement_from_request_parts.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ error[E0277]: the trait bound `String: FromRequestParts<()>` is not satisfied
44
5 | async fn handler(_: String, _: Method) {}
55
| ^^^^^^ the trait `FromRequestParts<()>` is not implemented for `String`
66
|
7+
= note: Function argument is no valid axum extractor.
8+
See `https://docs.rs/axum/latest/axum/extract/index.html` for details
79
= help: the following other types implement trait `FromRequestParts<S>`:
810
<() as FromRequestParts<S>>
911
<(T1, T2) as FromRequestParts<S>>
@@ -15,3 +17,4 @@ error[E0277]: the trait bound `String: FromRequestParts<()>` is not satisfied
1517
<(T1, T2, T3, T4, T5, T6, T7, T8) as FromRequestParts<S>>
1618
and 25 others
1719
= help: see issue #48214
20+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable

axum-macros/tests/debug_handler/fail/not_send.stderr

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
error: future cannot be sent between threads safely
22
--> tests/debug_handler/fail/not_send.rs:4:1
33
|
4-
4 | async fn handler() {
5-
| ^^^^^ future returned by `handler` is not `Send`
4+
4 | / async fn handler() {
5+
5 | | let rc = std::rc::Rc::new(());
6+
6 | | async {}.await;
7+
7 | | }
8+
| |_^ future returned by `handler` is not `Send`
69
|
710
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
811
note: future is not `Send` as this value is used across an await
@@ -17,5 +20,8 @@ note: future is not `Send` as this value is used across an await
1720
note: required by a bound in `check`
1821
--> tests/debug_handler/fail/not_send.rs:4:1
1922
|
20-
4 | async fn handler() {
21-
| ^^^^^ required by this bound in `check`
23+
4 | / async fn handler() {
24+
5 | | let rc = std::rc::Rc::new(());
25+
6 | | async {}.await;
26+
7 | | }
27+
| |_^ required by this bound in `check`

axum-macros/tests/from_request/fail/generic_without_via.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {fo
88
--> tests/from_request/fail/generic_without_via.rs:10:46
99
|
1010
10 | Router::<(), Body>::new().route("/", get(foo));
11-
| --- ^^^ the trait `Handler<_, _, _>` is not implemented for `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
11+
| --- ^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
1212
| |
1313
| required by a bound introduced by this call
1414
|
15+
= note: Consider using `#[axum_macros::debug_handler]` to improve the error message
1516
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
1617
note: required by a bound in `axum::routing::get`
1718
--> $WORKSPACE/axum/src/routing/method_routing.rs

axum-macros/tests/from_request/fail/generic_without_via_rejection.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {fo
88
--> tests/from_request/fail/generic_without_via_rejection.rs:11:46
99
|
1010
11 | Router::<(), Body>::new().route("/", get(foo));
11-
| --- ^^^ the trait `Handler<_, _, _>` is not implemented for `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
11+
| --- ^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
1212
| |
1313
| required by a bound introduced by this call
1414
|
15+
= note: Consider using `#[axum_macros::debug_handler]` to improve the error message
1516
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
1617
note: required by a bound in `axum::routing::get`
1718
--> $WORKSPACE/axum/src/routing/method_routing.rs

axum-macros/tests/from_request/fail/override_rejection_on_enum_without_via.stderr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ error[E0277]: the trait bound `fn(MyExtractor) -> impl Future<Output = ()> {hand
88
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:50
99
|
1010
10 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
11-
| --- ^^^^^^^ the trait `Handler<_, _, _>` is not implemented for `fn(MyExtractor) -> impl Future<Output = ()> {handler}`
11+
| --- ^^^^^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(MyExtractor) -> impl Future<Output = ()> {handler}`
1212
| |
1313
| required by a bound introduced by this call
1414
|
15+
= note: Consider using `#[axum_macros::debug_handler]` to improve the error message
1516
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
1617
note: required by a bound in `axum::routing::get`
1718
--> $WORKSPACE/axum/src/routing/method_routing.rs
@@ -24,10 +25,11 @@ error[E0277]: the trait bound `fn(Result<MyExtractor, MyRejection>) -> impl Futu
2425
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:64
2526
|
2627
10 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
27-
| ---- ^^^^^^^^^^^^^^ the trait `Handler<_, _, _>` is not implemented for `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}`
28+
| ---- ^^^^^^^^^^^^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}`
2829
| |
2930
| required by a bound introduced by this call
3031
|
32+
= note: Consider using `#[axum_macros::debug_handler]` to improve the error message
3133
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
3234
note: required by a bound in `MethodRouter::<S, B>::post`
3335
--> $WORKSPACE/axum/src/routing/method_routing.rs

axum-macros/tests/from_request/fail/parts_extracting_body.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ error[E0277]: the trait bound `String: FromRequestParts<S>` is not satisfied
44
6 | body: String,
55
| ^^^^^^ the trait `FromRequestParts<S>` is not implemented for `String`
66
|
7+
= note: Function argument is no valid axum extractor.
8+
See `https://docs.rs/axum/latest/axum/extract/index.html` for details
79
= help: the following other types implement trait `FromRequestParts<S>`:
810
<() as FromRequestParts<S>>
911
<(T1, T2) as FromRequestParts<S>>

axum-macros/tests/from_request/fail/state_infer_multiple_different_types.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error[E0277]: the trait bound `AppState: FromRef<S>` is not satisfied
22
--> tests/from_request/fail/state_infer_multiple_different_types.rs:6:18
33
|
44
6 | inner_state: State<AppState>,
5-
| ^^^^^ the trait `FromRef<S>` is not implemented for `AppState`
5+
| ^^^^^^^^^^^^^^^ the trait `FromRef<S>` is not implemented for `AppState`
66
|
7-
= note: required because of the requirements on the impl of `FromRequestParts<S>` for `State<AppState>`
7+
= note: required for `State<AppState>` to implement `FromRequestParts<S>`
88
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
99
|
1010
4 | #[derive(FromRequest, AppState: FromRef<S>)]
@@ -14,9 +14,9 @@ error[E0277]: the trait bound `OtherState: FromRef<S>` is not satisfied
1414
--> tests/from_request/fail/state_infer_multiple_different_types.rs:7:18
1515
|
1616
7 | other_state: State<OtherState>,
17-
| ^^^^^ the trait `FromRef<S>` is not implemented for `OtherState`
17+
| ^^^^^^^^^^^^^^^^^ the trait `FromRef<S>` is not implemented for `OtherState`
1818
|
19-
= note: required because of the requirements on the impl of `FromRequestParts<S>` for `State<OtherState>`
19+
= note: required for `State<OtherState>` to implement `FromRequestParts<S>`
2020
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
2121
|
2222
4 | #[derive(FromRequest, OtherState: FromRef<S>)]

axum-macros/tests/typed_path/fail/not_deserialize.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ error[E0277]: the trait bound `for<'de> MyPath: serde::de::Deserialize<'de>` is
1414
(T0, T1, T2)
1515
(T0, T1, T2, T3)
1616
and 129 others
17-
= note: required because of the requirements on the impl of `serde::de::DeserializeOwned` for `MyPath`
18-
= note: required because of the requirements on the impl of `FromRequestParts<S>` for `axum::extract::Path<MyPath>`
17+
= note: required for `MyPath` to implement `serde::de::DeserializeOwned`
18+
= note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>`
1919
= note: this error originates in the derive macro `TypedPath` (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)