syntax/hir: give loop labels a span

This makes the "shadowing labels" warning *not* print the entire loop
as a span, but only the lifetime.

Also makes #31719 go away, but does not fix its root cause (the span
of the expanded loop is still wonky, but not used anymore).
This commit is contained in:
Georg Brandl
2016-05-02 18:22:03 +02:00
committed by Georg Brandl
parent dd6e8d45e1
commit 2e812e10f4
14 changed files with 99 additions and 83 deletions

View File

@@ -2021,7 +2021,7 @@ impl<'a> State<'a> {
}
ast::ExprKind::While(ref test, ref blk, opt_ident) => {
if let Some(ident) = opt_ident {
self.print_ident(ident)?;
self.print_ident(ident.node)?;
self.word_space(":")?;
}
self.head("while")?;
@@ -2031,7 +2031,7 @@ impl<'a> State<'a> {
}
ast::ExprKind::WhileLet(ref pat, ref expr, ref blk, opt_ident) => {
if let Some(ident) = opt_ident {
self.print_ident(ident)?;
self.print_ident(ident.node)?;
self.word_space(":")?;
}
self.head("while let")?;
@@ -2044,7 +2044,7 @@ impl<'a> State<'a> {
}
ast::ExprKind::ForLoop(ref pat, ref iter, ref blk, opt_ident) => {
if let Some(ident) = opt_ident {
self.print_ident(ident)?;
self.print_ident(ident.node)?;
self.word_space(":")?;
}
self.head("for")?;
@@ -2057,7 +2057,7 @@ impl<'a> State<'a> {
}
ast::ExprKind::Loop(ref blk, opt_ident) => {
if let Some(ident) = opt_ident {
self.print_ident(ident)?;
self.print_ident(ident.node)?;
self.word_space(":")?;
}
self.head("loop")?;