mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
000dbd27f1
Add proc_macro::Span::{before, after}. This adds `proc_macro::Span::before()` and `proc_macro::Span::after()` to get a zero width span at the start or end of the span. These are equivalent to rustc's `Span::shrink_to_lo()` and `Span::shrink_to_hi()` but with a less cryptic name. They are useful when generating diagnostlics like "missing \<thing\> after \<thing\>". E.g. ```rust syn::Error::new(ident.span().after(), "missing `:` after field name").into_compile_error() ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |