diff --git a/src/librustc_front/fold.rs b/src/librustc_front/fold.rs index c663ebbf945..ba20b46090a 100644 --- a/src/librustc_front/fold.rs +++ b/src/librustc_front/fold.rs @@ -1124,8 +1124,14 @@ pub fn noop_fold_expr(Expr {id, node, span}: Expr, folder: &mut T) -> }); ExprPath(qself, folder.fold_path(path)) } - ExprBreak(opt_ident) => ExprBreak(opt_ident.map(|x| folder.fold_ident(x))), - ExprAgain(opt_ident) => ExprAgain(opt_ident.map(|x| folder.fold_ident(x))), + ExprBreak(opt_ident) => ExprBreak(opt_ident.map(|label| + respan(folder.new_span(label.span), + folder.fold_ident(label.node))) + ), + ExprAgain(opt_ident) => ExprAgain(opt_ident.map(|label| + respan(folder.new_span(label.span), + folder.fold_ident(label.node))) + ), ExprRet(e) => ExprRet(e.map(|x| folder.fold_expr(x))), ExprInlineAsm(InlineAsm { inputs, diff --git a/src/librustc_front/hir.rs b/src/librustc_front/hir.rs index 6d7bef32ff7..4a53a4c60cf 100644 --- a/src/librustc_front/hir.rs +++ b/src/librustc_front/hir.rs @@ -730,9 +730,9 @@ pub enum Expr_ { /// A referencing operation (`&a` or `&mut a`) ExprAddrOf(Mutability, P), /// A `break`, with an optional label to break - ExprBreak(Option), + ExprBreak(Option), /// A `continue`, with an optional label - ExprAgain(Option), + ExprAgain(Option), /// A `return`, with an optional value to be returned ExprRet(Option>), diff --git a/src/librustc_front/print/pprust.rs b/src/librustc_front/print/pprust.rs index eeb1f2e167a..2f106f6a9e1 100644 --- a/src/librustc_front/print/pprust.rs +++ b/src/librustc_front/print/pprust.rs @@ -1587,7 +1587,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "break")); try!(space(&mut self.s)); if let Some(ident) = opt_ident { - try!(self.print_ident(ident)); + try!(self.print_ident(ident.node)); try!(space(&mut self.s)); } } @@ -1595,7 +1595,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "continue")); try!(space(&mut self.s)); if let Some(ident) = opt_ident { - try!(self.print_ident(ident)); + try!(self.print_ident(ident.node)); try!(space(&mut self.s)) } }