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 }
}
fn before(&mut self, span: Self::Span) -> Self::Span {
fn start(&mut self, span: Self::Span) -> Self::Span {
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()
}

View File

@ -95,8 +95,8 @@ macro_rules! with_api {
fn parent($self: $S::Span) -> Option<$S::Span>;
fn source($self: $S::Span) -> $S::Span;
fn byte_range($self: $S::Span) -> Range<usize>;
fn before($self: $S::Span) -> $S::Span;
fn after($self: $S::Span) -> $S::Span;
fn start($self: $S::Span) -> $S::Span;
fn end($self: $S::Span) -> $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 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.
#[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
pub fn before(&self) -> Span {
Span(self.0.before())
pub fn start(&self) -> Span {
Span(self.0.start())
}
/// Creates an empty span pointing to directly after this span.
#[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
pub fn after(&self) -> Span {
Span(self.0.after())
pub fn end(&self) -> Span {
Span(self.0.end())
}
/// Creates a new span encompassing `self` and `other`.

View File

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