Skip to content

use proc-macro-error to show the span of macro errors

Robin Appelman requested to merge icewind/err-derive:span_error into master

Instead of sharing the error message from the macro invocation show it from the code that causes the error

Before:

error: proc-macro derive panicked
  --> src/demo/parser/mod.rs:20:17
   |
20 | #[derive(Debug, Error)]
   |                 ^^^^^
   |
   = help: message: Error attribute must begin `display = ""` to control the Display message.

after

error: Error attribute must begin `display = ""` to control the Display message.
  --> src/demo/parser/mod.rs:28:13
   |
28 |     #[error(display)]
   |             ^^^^^^^

Merge request reports