Remove LineColumn
, Span::start
, Span::end
This commit is contained in:
parent
a34ceade11
commit
dc76991d2f
4 changed files with 2 additions and 76 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use crate::{Delimiter, Level, LineColumn, Spacing};
|
||||
use crate::{Delimiter, Level, Spacing};
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use std::marker;
|
||||
|
@ -95,8 +95,6 @@ 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 start($self: $S::Span) -> LineColumn;
|
||||
fn end($self: $S::Span) -> LineColumn;
|
||||
fn before($self: $S::Span) -> $S::Span;
|
||||
fn after($self: $S::Span) -> $S::Span;
|
||||
fn join($self: $S::Span, other: $S::Span) -> Option<$S::Span>;
|
||||
|
@ -299,7 +297,6 @@ mark_noop! {
|
|||
Delimiter,
|
||||
LitKind,
|
||||
Level,
|
||||
LineColumn,
|
||||
Spacing,
|
||||
}
|
||||
|
||||
|
@ -319,7 +316,6 @@ rpc_encode_decode!(
|
|||
Help,
|
||||
}
|
||||
);
|
||||
rpc_encode_decode!(struct LineColumn { line, column });
|
||||
rpc_encode_decode!(
|
||||
enum Spacing {
|
||||
Alone,
|
||||
|
|
|
@ -43,7 +43,6 @@ mod diagnostic;
|
|||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub use diagnostic::{Diagnostic, Level, MultiSpan};
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::ops::{Range, RangeBounds};
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
@ -494,18 +493,6 @@ impl Span {
|
|||
self.0.byte_range()
|
||||
}
|
||||
|
||||
/// Gets the starting line/column in the source file for this span.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub fn start(&self) -> LineColumn {
|
||||
self.0.start().add_1_to_column()
|
||||
}
|
||||
|
||||
/// Gets the ending line/column in the source file for this span.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub fn end(&self) -> LineColumn {
|
||||
self.0.end().add_1_to_column()
|
||||
}
|
||||
|
||||
/// Creates an empty span pointing to directly before this span.
|
||||
#[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
|
||||
pub fn before(&self) -> Span {
|
||||
|
@ -586,44 +573,6 @@ impl fmt::Debug for Span {
|
|||
}
|
||||
}
|
||||
|
||||
/// A line-column pair representing the start or end of a `Span`.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct LineColumn {
|
||||
/// The 1-indexed line in the source file on which the span starts or ends (inclusive).
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub line: usize,
|
||||
/// The 1-indexed column (number of bytes in UTF-8 encoding) in the source
|
||||
/// file on which the span starts or ends (inclusive).
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub column: usize,
|
||||
}
|
||||
|
||||
impl LineColumn {
|
||||
fn add_1_to_column(self) -> Self {
|
||||
LineColumn { line: self.line, column: self.column + 1 }
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
impl !Send for LineColumn {}
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
impl !Sync for LineColumn {}
|
||||
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
impl Ord for LineColumn {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.line.cmp(&other.line).then(self.column.cmp(&other.column))
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
impl PartialOrd for LineColumn {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
/// The source file of a given `Span`.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
#[derive(Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue