The tokens generated by proc_macro (e.g. from quote!()) use Span::call_site(), which makes some suggestions produce invalid output:
error[E0308]: mismatched types
--> src/main.rs:3:1
|
3 | #[hello]
| ^^^^^^^^
| |
| expected `&mut i32`, found integer
| help: consider mutably borrowing here: `&mut #[hello]`
It's a bit tricky, because this call_site span does point into the current crate (to #[hello]), so this situaiton isn't detected in the same way as external macro_rules.
The tokens generated by proc_macro (e.g. from
quote!()) useSpan::call_site(), which makes some suggestions produce invalid output:It's a bit tricky, because this call_site span does point into the current crate (to
#[hello]), so this situaiton isn't detected in the same way as externalmacro_rules.