rust/library/proc_macro/src
Manish Goregaokar 000dbd27f1
Rollup merge of #86165 - m-ou-se:proc-macro-span-shrink, r=dtolnay
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()
```
2021-09-10 08:23:14 -07:00
..
bridge Rollup merge of #86165 - m-ou-se:proc-macro-span-shrink, r=dtolnay 2021-09-10 08:23:14 -07:00
diagnostic.rs Change proc_macro::Diagnostics docs 2021-08-07 23:54:34 +10:00
lib.rs Rollup merge of #86165 - m-ou-se:proc-macro-span-shrink, r=dtolnay 2021-09-10 08:23:14 -07:00
quote.rs Implement span quoting for proc-macros 2021-05-12 00:51:31 -04:00