Span::{before, after}Span::{start, end}

This commit is contained in:
Jacob Pratt 2023-05-14 18:11:27 -04:00
parent dc76991d2f
commit 87ec0738ab
No known key found for this signature in database
GPG Key ID: 6E2E55C5F9ABB247
4 changed files with 10 additions and 10 deletions

View File

@ -648,11 +648,11 @@ impl server::Span for Rustc<'_, '_> {
Range { start: relative_start_pos.0 as usize, end: relative_end_pos.0 as usize } Range { start: relative_start_pos.0 as usize, end: relative_end_pos.0 as usize }
} }
fn before(&mut self, span: Self::Span) -> Self::Span { fn start(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_lo() span.shrink_to_lo()
} }
fn after(&mut self, span: Self::Span) -> Self::Span { fn end(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_hi() span.shrink_to_hi()
} }

View File

@ -95,8 +95,8 @@ macro_rules! with_api {
fn parent($self: $S::Span) -> Option<$S::Span>; fn parent($self: $S::Span) -> Option<$S::Span>;
fn source($self: $S::Span) -> $S::Span; fn source($self: $S::Span) -> $S::Span;
fn byte_range($self: $S::Span) -> Range<usize>; fn byte_range($self: $S::Span) -> Range<usize>;
fn before($self: $S::Span) -> $S::Span; fn start($self: $S::Span) -> $S::Span;
fn after($self: $S::Span) -> $S::Span; fn end($self: $S::Span) -> $S::Span;
fn join($self: $S::Span, other: $S::Span) -> Option<$S::Span>; fn join($self: $S::Span, other: $S::Span) -> Option<$S::Span>;
fn subspan($self: $S::Span, start: Bound<usize>, end: Bound<usize>) -> Option<$S::Span>; fn subspan($self: $S::Span, start: Bound<usize>, end: Bound<usize>) -> Option<$S::Span>;
fn resolved_at($self: $S::Span, at: $S::Span) -> $S::Span; fn resolved_at($self: $S::Span, at: $S::Span) -> $S::Span;

View File

@ -495,14 +495,14 @@ impl Span {
/// Creates an empty span pointing to directly before this span. /// Creates an empty span pointing to directly before this span.
#[unstable(feature = "proc_macro_span_shrink", issue = "87552")] #[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
pub fn before(&self) -> Span { pub fn start(&self) -> Span {
Span(self.0.before()) Span(self.0.start())
} }
/// Creates an empty span pointing to directly after this span. /// Creates an empty span pointing to directly after this span.
#[unstable(feature = "proc_macro_span_shrink", issue = "87552")] #[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
pub fn after(&self) -> Span { pub fn end(&self) -> Span {
Span(self.0.after()) Span(self.0.end())
} }
/// Creates a new span encompassing `self` and `other`. /// Creates a new span encompassing `self` and `other`.

View File

@ -322,11 +322,11 @@ impl server::Span for RustAnalyzer {
tt::TokenId::unspecified() tt::TokenId::unspecified()
} }
fn after(&mut self, _self_: Self::Span) -> Self::Span { fn end(&mut self, _self_: Self::Span) -> Self::Span {
tt::TokenId::unspecified() tt::TokenId::unspecified()
} }
fn before(&mut self, _self_: Self::Span) -> Self::Span { fn start(&mut self, _self_: Self::Span) -> Self::Span {
tt::TokenId::unspecified() tt::TokenId::unspecified()
} }
} }