summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_expand/src/proc_macro_server.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /compiler/rustc_expand/src/proc_macro_server.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_expand/src/proc_macro_server.rs')
-rw-r--r--compiler/rustc_expand/src/proc_macro_server.rs23
1 files changed, 11 insertions, 12 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs
index 891e84a2f..ecd231511 100644
--- a/compiler/rustc_expand/src/proc_macro_server.rs
+++ b/compiler/rustc_expand/src/proc_macro_server.rs
@@ -2,7 +2,7 @@ use crate::base::ExtCtxt;
use pm::bridge::{
server, DelimSpan, Diagnostic, ExpnGlobals, Group, Ident, LitKind, Literal, Punct, TokenTree,
};
-use pm::{Delimiter, Level, LineColumn};
+use pm::{Delimiter, Level};
use rustc_ast as ast;
use rustc_ast::token;
use rustc_ast::tokenstream::{self, Spacing::*, TokenStream};
@@ -648,23 +648,22 @@ impl server::Span for Rustc<'_, '_> {
Range { start: relative_start_pos.0 as usize, end: relative_end_pos.0 as usize }
}
-
- fn start(&mut self, span: Self::Span) -> LineColumn {
- let loc = self.sess().source_map().lookup_char_pos(span.lo());
- LineColumn { line: loc.line, column: loc.col.to_usize() }
+ fn start(&mut self, span: Self::Span) -> Self::Span {
+ span.shrink_to_lo()
}
- fn end(&mut self, span: Self::Span) -> LineColumn {
- let loc = self.sess().source_map().lookup_char_pos(span.hi());
- LineColumn { line: loc.line, column: loc.col.to_usize() }
+ fn end(&mut self, span: Self::Span) -> Self::Span {
+ span.shrink_to_hi()
}
- fn before(&mut self, span: Self::Span) -> Self::Span {
- span.shrink_to_lo()
+ fn line(&mut self, span: Self::Span) -> usize {
+ let loc = self.sess().source_map().lookup_char_pos(span.lo());
+ loc.line
}
- fn after(&mut self, span: Self::Span) -> Self::Span {
- span.shrink_to_hi()
+ fn column(&mut self, span: Self::Span) -> usize {
+ let loc = self.sess().source_map().lookup_char_pos(span.lo());
+ loc.col.to_usize() + 1
}
fn join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {