#![feature(const_fn)]
#![feature(crate_visibility_modifier)]
-#![feature(custom_attribute)]
#![feature(nll)]
#![feature(non_exhaustive)]
#![feature(optin_builtin_traits)]
)
}
- pub fn from_inner_byte_pos(self, start: usize, end: usize) -> Span {
+ pub fn from_inner(self, inner: InnerSpan) -> Span {
let span = self.data();
- Span::new(span.lo + BytePos::from_usize(start),
- span.lo + BytePos::from_usize(end),
+ Span::new(span.lo + BytePos::from_usize(inner.start),
+ span.lo + BytePos::from_usize(inner.end),
span.ctxt)
}
mark
}
+ #[inline]
+ pub fn modernize_and_adjust(&mut self, expansion: Mark) -> Option<Mark> {
+ let mut span = self.data();
+ let mark = span.ctxt.modernize_and_adjust(expansion);
+ *self = Span::new(span.lo, span.hi, span.ctxt);
+ mark
+ }
+
#[inline]
pub fn glob_adjust(&mut self, expansion: Mark, glob_span: Span) -> Option<Option<Mark>> {
let mut span = self.data();
pub end_pos: BytePos
}
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub struct InnerSpan {
+ pub start: usize,
+ pub end: usize,
+}
+
+impl InnerSpan {
+ pub fn new(start: usize, end: usize) -> InnerSpan {
+ InnerSpan { start, end }
+ }
+}
+
// Given a slice of line start positions and a position, returns the index of
// the line the position is on. Returns -1 if the position is located before
// the first line.