richardanaya / view

a macro for constructing views in Rust 🏗️
Apache License 2.0
104 stars 3 forks source link

Spanned error reports #1

Open Plecra opened 3 years ago

Plecra commented 3 years ago

Panicking in a proc macro doesn't give the user particularly helpful errors. There's no way for them to know where their syntax error is, and the title of the error is the worrying "procedural macro panicked".

Instead, you can emit an invocation of the compile_error macro to give the user a more helpful error. If you give the tokens the span of the invalid tokens, rustc's error will even highlight them.

richardanaya commented 3 years ago

I’ll look into this!