Fix a span bug for qualified paths
This commit is contained in:
parent
374af4aea7
commit
f28f79b796
2 changed files with 17 additions and 4 deletions
|
@ -1566,12 +1566,13 @@ impl<'a> Parser<'a> {
|
||||||
// Assumes that the leading `<` has been parsed already.
|
// Assumes that the leading `<` has been parsed already.
|
||||||
pub fn parse_qualified_path(&mut self, mode: PathParsingMode)
|
pub fn parse_qualified_path(&mut self, mode: PathParsingMode)
|
||||||
-> PResult<(QSelf, ast::Path)> {
|
-> PResult<(QSelf, ast::Path)> {
|
||||||
|
let span = self.last_span;
|
||||||
let self_type = try!(self.parse_ty_sum());
|
let self_type = try!(self.parse_ty_sum());
|
||||||
let mut path = if try!(self.eat_keyword(keywords::As)) {
|
let mut path = if try!(self.eat_keyword(keywords::As)) {
|
||||||
try!(self.parse_path(LifetimeAndTypesWithoutColons))
|
try!(self.parse_path(LifetimeAndTypesWithoutColons))
|
||||||
} else {
|
} else {
|
||||||
ast::Path {
|
ast::Path {
|
||||||
span: self.span,
|
span: span,
|
||||||
global: false,
|
global: false,
|
||||||
segments: vec![]
|
segments: vec![]
|
||||||
}
|
}
|
||||||
|
@ -1598,9 +1599,6 @@ impl<'a> Parser<'a> {
|
||||||
};
|
};
|
||||||
path.segments.extend(segments);
|
path.segments.extend(segments);
|
||||||
|
|
||||||
if path.segments.len() == 1 {
|
|
||||||
path.span.lo = self.last_span.lo;
|
|
||||||
}
|
|
||||||
path.span.hi = self.last_span.hi;
|
path.span.hi = self.last_span.hi;
|
||||||
|
|
||||||
Ok((qself, path))
|
Ok((qself, path))
|
||||||
|
|
|
@ -364,3 +364,18 @@ impl<'a> Pattern<'a> for CharEqPattern {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CharSearcher<'a>(<CharEqPattern as Pattern<'a>>::Searcher);
|
struct CharSearcher<'a>(<CharEqPattern as Pattern<'a>>::Searcher);
|
||||||
|
|
||||||
|
pub trait Error {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Error + 'static {
|
||||||
|
pub fn is<T: Error + 'static>(&self) -> bool {
|
||||||
|
panic!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Error + 'static + Send {
|
||||||
|
pub fn is<T: Error + 'static>(&self) -> bool {
|
||||||
|
<Error + 'static>::is::<T>(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue