axum/axum-macros/tests/debug_handler/fail/not_send.stderr
Georg Semmler d5de3bc7e3
Improve compile errors for unimplemented traits (#1436)
* Improve `debug_handler` to use the correct span for specific bounds

This results in better localised error messages, as they now point
directly to the corresponding argument instead of to the macro itself.

* Improve some error messages behind a `nightly-error-messages` feature
flag

This uses the nightly only `rustc_on_unimplemented` attribute to improve
some error messages when users try to use invalid handler functions.
This should be seen as prove of concept, not as full solution for all
potential error cases.

The underlying feature is currently marked as permanently unstable, but
I'm working on getting this specific attribute (or an attribute with
different name, similar functionality) ready to work on a stable compiler.

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* Enable the `nightly-error-messages` feature unconditionally for nightly compilers

* Use a nightly compiler to run the axum-marcos compile fail tests

* update to newer nightly

* Run axum-macros tests on nightly

* tweak compile error hints a bit

* more tweaks

* update test

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-11-19 12:45:03 +01:00

27 lines
924 B
Text

error: future cannot be sent between threads safely
--> tests/debug_handler/fail/not_send.rs:4:1
|
4 | / async fn handler() {
5 | | let rc = std::rc::Rc::new(());
6 | | async {}.await;
7 | | }
| |_^ future returned by `handler` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
--> tests/debug_handler/fail/not_send.rs:6:13
|
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:4:1
|
4 | / async fn handler() {
5 | | let rc = std::rc::Rc::new(());
6 | | async {}.await;
7 | | }
| |_^ required by this bound in `check`