Skip to content

Commit

Permalink
Span::{before, after}Span::{start, end}
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Jun 20, 2023
1 parent dc76991 commit 87ec073
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
4 changes: 2 additions & 2 deletions library/proc_macro/src/bridge/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/proc-macro-srv/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit 87ec073

Please sign in to comment.