diff options
4 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index e240b7d4551..71dfd3158dc 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -634,8 +634,8 @@ impl server::Span for Rustc<'_, '_> { span.source_callsite() } - fn position(&mut self, span: Self::Span) -> Range<u32> { - Range { start: span.lo().0, end: span.hi().0 } + fn byte_range(&mut self, span: Self::Span) -> Range<usize> { + Range { start: span.lo().0 as usize, end: span.hi().0 as usize } } fn start(&mut self, span: Self::Span) -> LineColumn { diff --git a/library/proc_macro/src/bridge/mod.rs b/library/proc_macro/src/bridge/mod.rs index aedfecf51a5..54b11c543f1 100644 --- a/library/proc_macro/src/bridge/mod.rs +++ b/library/proc_macro/src/bridge/mod.rs @@ -94,7 +94,7 @@ macro_rules! with_api { fn source_file($self: $S::Span) -> $S::SourceFile; fn parent($self: $S::Span) -> Option<$S::Span>; fn source($self: $S::Span) -> $S::Span; - fn position($self: $S::Span) -> Range<u32>; + fn byte_range($self: $S::Span) -> Range<usize>; fn start($self: $S::Span) -> LineColumn; fn end($self: $S::Span) -> LineColumn; fn before($self: $S::Span) -> $S::Span; @@ -295,7 +295,6 @@ mark_noop! { &'_ str, String, u8, - u32, usize, Delimiter, LitKind, diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 063de6f5438..c6cfc9c65f7 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -490,8 +490,8 @@ impl Span { /// Returns the span's byte position range in the source file. #[unstable(feature = "proc_macro_span", issue = "54725")] - pub fn position(&self) -> Range<u32> { - self.0.position() + pub fn byte_range(&self) -> Range<usize> { + self.0.byte_range() } /// Gets the starting line/column in the source file for this span. diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/abi_sysroot/ra_server.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/abi_sysroot/ra_server.rs index e46d51f7b05..a9cd8e705a4 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/abi_sysroot/ra_server.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/abi_sysroot/ra_server.rs @@ -298,7 +298,7 @@ impl server::Span for RustAnalyzer { // FIXME handle span span } - fn position(&mut self, _span: Self::Span) -> Range<u32> { + fn byte_range(&mut self, _span: Self::Span) -> Range<usize> { // FIXME handle span Range { start: 0, end: 0 } } |
