Skip to content

Commit c67ae04

Browse files
Renamed to byte_range and changed Range generics [skip ci]
1 parent 3a3ecbf commit c67ae04

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ impl server::Span for Rustc<'_, '_> {
634634
span.source_callsite()
635635
}
636636

637-
fn position(&mut self, span: Self::Span) -> Range<u32> {
638-
Range { start: span.lo().0, end: span.hi().0 }
637+
fn byte_range(&mut self, span: Self::Span) -> Range<usize> {
638+
Range { start: span.lo().0 as usize, end: span.hi().0 as usize }
639639
}
640640

641641
fn start(&mut self, span: Self::Span) -> LineColumn {

library/proc_macro/src/bridge/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ macro_rules! with_api {
9494
fn source_file($self: $S::Span) -> $S::SourceFile;
9595
fn parent($self: $S::Span) -> Option<$S::Span>;
9696
fn source($self: $S::Span) -> $S::Span;
97-
fn position($self: $S::Span) -> Range<u32>;
97+
fn byte_range($self: $S::Span) -> Range<usize>;
9898
fn start($self: $S::Span) -> LineColumn;
9999
fn end($self: $S::Span) -> LineColumn;
100100
fn before($self: $S::Span) -> $S::Span;
@@ -295,7 +295,6 @@ mark_noop! {
295295
&'_ str,
296296
String,
297297
u8,
298-
u32,
299298
usize,
300299
Delimiter,
301300
LitKind,

library/proc_macro/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ impl Span {
490490

491491
/// Returns the span's byte position range in the source file.
492492
#[unstable(feature = "proc_macro_span", issue = "54725")]
493-
pub fn position(&self) -> Range<u32> {
494-
self.0.position()
493+
pub fn byte_range(&self) -> Range<usize> {
494+
self.0.byte_range()
495495
}
496496

497497
/// Gets the starting line/column in the source file for this span.

src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/abi_sysroot/ra_server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl server::Span for RustAnalyzer {
298298
// FIXME handle span
299299
span
300300
}
301-
fn position(&mut self, _span: Self::Span) -> Range<u32> {
301+
fn byte_range(&mut self, _span: Self::Span) -> Range<usize> {
302302
// FIXME handle span
303303
Range { start: 0, end: 0 }
304304
}

0 commit comments

Comments
 (0)