-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compile error with !Send handler shows none useful clue #299
Comments
change sync::Mutex to tokio::sync::Mutex will fix the problem, maybe because std::sync::Mutex is not Send |
I have update the code:
|
axum does not allow
But tbh I haven't benchmarked or investigated this further as I didn't consider it much of an issue, although a few asked about it. I think the general recommendation is to use a non-async mutex if you're not doing IO while holding the lock otherwise use an actor to coordinate access. And yes the type error is very very bad 😞 Unfortunately there is nothing we can do in axum to improve that. The machinery that makes variadic handler functions work really hurts the error messages. |
At least,hope there is any method to get the clear type compil error output, otherwise it's too hard for axum beginners! |
I'm not aware of any. |
I'll close this issue for now. I'm not sure there is much we can do. Would like to hear from someone who has ideas. |
Bug Report
Version
0.23
Platform
Linux dev01 5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Description
I have a minimal reproduction ,
https://github.com/mineralres/axum/tree/share-state-test (branch: share-state-test)
cd examples/error-handling-and-dependency-injection
cargo build
get the next comile error
The text was updated successfully, but these errors were encountered: