axum icon indicating copy to clipboard operation
axum copied to clipboard

Improve error messages

Open weiznich opened this issue 3 years ago • 0 comments

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.

weiznich avatar Sep 30 '22 13:09 weiznich