Skip to content

Commit f28f79b

Browse files
committed
Fix a span bug for qualified paths
1 parent 374af4a commit f28f79b

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,12 +1566,13 @@ impl<'a> Parser<'a> {
15661566
// Assumes that the leading `<` has been parsed already.
15671567
pub fn parse_qualified_path(&mut self, mode: PathParsingMode)
15681568
-> PResult<(QSelf, ast::Path)> {
1569+
let span = self.last_span;
15691570
let self_type = try!(self.parse_ty_sum());
15701571
let mut path = if try!(self.eat_keyword(keywords::As)) {
15711572
try!(self.parse_path(LifetimeAndTypesWithoutColons))
15721573
} else {
15731574
ast::Path {
1574-
span: self.span,
1575+
span: span,
15751576
global: false,
15761577
segments: vec![]
15771578
}
@@ -1598,9 +1599,6 @@ impl<'a> Parser<'a> {
15981599
};
15991600
path.segments.extend(segments);
16001601

1601-
if path.segments.len() == 1 {
1602-
path.span.lo = self.last_span.lo;
1603-
}
16041602
path.span.hi = self.last_span.hi;
16051603

16061604
Ok((qself, path))

src/test/run-make/save-analysis/foo.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,18 @@ impl<'a> Pattern<'a> for CharEqPattern {
364364
}
365365

366366
struct CharSearcher<'a>(<CharEqPattern as Pattern<'a>>::Searcher);
367+
368+
pub trait Error {
369+
}
370+
371+
impl Error + 'static {
372+
pub fn is<T: Error + 'static>(&self) -> bool {
373+
panic!()
374+
}
375+
}
376+
377+
impl Error + 'static + Send {
378+
pub fn is<T: Error + 'static>(&self) -> bool {
379+
<Error + 'static>::is::<T>(self)
380+
}
381+
}

0 commit comments

Comments
 (0)