diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-06-09 14:37:10 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-06-09 12:43:59 +0000 |
| commit | d5aec64c12db44ddcfbf8682b9ec4e515a6f9953 (patch) | |
| tree | e5798eca672294ddee3d0326989fd3c69e9e857a /compiler/rustc_expand/src | |
| parent | cc9610bf5af1d5c54968db0dd899595ca12307a0 (diff) | |
| download | rust-d5aec64c12db44ddcfbf8682b9ec4e515a6f9953.tar.gz rust-d5aec64c12db44ddcfbf8682b9ec4e515a6f9953.zip | |
Add proc_macro::Span::{before, after}.
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro_server.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 92315c4d4f6..2507ad44307 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -738,6 +738,12 @@ impl server::Span for Rustc<'_> { let loc = self.sess.source_map().lookup_char_pos(span.hi()); LineColumn { line: loc.line, column: loc.col.to_usize() } } + fn before(&mut self, span: Self::Span) -> Self::Span { + span.shrink_to_lo() + } + fn after(&mut self, span: Self::Span) -> Self::Span { + span.shrink_to_hi() + } fn join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> { let self_loc = self.sess.source_map().lookup_char_pos(first.lo()); let other_loc = self.sess.source_map().lookup_char_pos(second.lo()); |
