added byte position range for proc_macro::Span
This commit is contained in:
@@ -44,7 +44,7 @@ mod diagnostic;
|
||||
pub use diagnostic::{Diagnostic, Level, MultiSpan};
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::ops::RangeBounds;
|
||||
use std::ops::{Range, RangeBounds};
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use std::{error, fmt, iter};
|
||||
@@ -488,6 +488,12 @@ impl Span {
|
||||
Span(self.0.source())
|
||||
}
|
||||
|
||||
/// Returns the spans byte position range in the source file.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub fn position(&self) -> Range<u32> {
|
||||
self.0.position()
|
||||
}
|
||||
|
||||
/// Gets the starting line/column in the source file for this span.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub fn start(&self) -> LineColumn {
|
||||
|
||||
Reference in New Issue
Block a user