axum
axum copied to clipboard
Improve error messages
These two commits try to improve error messages generated by rustc if some trait bound is not fulfilled.
The first commit simply improves the #[debug_handler] helper proc-macro attribute to set spans ins certain situation. This results in the corresponding error messages always pointing to a concrete handler argument instead of the attribute itself (see the updated compile tests).
The second commit introduces a rust nightly only nightly-error-messages feature flag + uses unstable rust attributes to improve some other error messages as well. It currently mostly points the users to use the #[debug_handler] attribute. In specific situation it additionally adds more information.. This is mostly meant as demonstration of what's possible. I currently try to push for stabilization of the underlying #[rustc_on_unimplemented] attribute.