diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 93facd255df5e..7e58a599e2c5c 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1950,7 +1950,6 @@ impl<'a> State<'a> { self.word_space(":"); } self.head("loop"); - self.s.space(); self.print_block_with_attrs(blk, attrs); } ast::ExprKind::Match(ref expr, ref arms) => { diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 2b932b7c9537e..9b1aca13a6f7a 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1538,7 +1538,6 @@ impl<'a> State<'a> { self.word_space(":"); } self.head("loop"); - self.s.space(); self.print_block(&blk); } hir::ExprKind::Match(ref expr, arms, _) => { diff --git a/src/test/pretty/ast-stmt-expr-attr.rs b/src/test/pretty/ast-stmt-expr-attr.rs index fb406514f4b5e..0c9ccfcf278ef 100644 --- a/src/test/pretty/ast-stmt-expr-attr.rs +++ b/src/test/pretty/ast-stmt-expr-attr.rs @@ -39,7 +39,7 @@ fn syntax() { #![attr] }; let _ = - #[attr] loop { + #[attr] loop { #![attr] }; let _ = diff --git a/src/test/pretty/hir-pretty-loop.pp b/src/test/pretty/hir-pretty-loop.pp new file mode 100644 index 0000000000000..19b3a1775cf36 --- /dev/null +++ b/src/test/pretty/hir-pretty-loop.pp @@ -0,0 +1,9 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// pretty-compare-only +// pretty-mode:hir +// pp-exact:hir-pretty-loop.pp + +pub fn foo() { loop { break ; } } diff --git a/src/test/pretty/hir-pretty-loop.rs b/src/test/pretty/hir-pretty-loop.rs new file mode 100644 index 0000000000000..87a3ef8b8f912 --- /dev/null +++ b/src/test/pretty/hir-pretty-loop.rs @@ -0,0 +1,9 @@ +// pretty-compare-only +// pretty-mode:hir +// pp-exact:hir-pretty-loop.pp + +pub fn foo(){ + loop{ + break; + } +} diff --git a/src/test/pretty/stmt_expr_attributes.rs b/src/test/pretty/stmt_expr_attributes.rs index 54a8438f1d041..87692905f51e5 100644 --- a/src/test/pretty/stmt_expr_attributes.rs +++ b/src/test/pretty/stmt_expr_attributes.rs @@ -159,9 +159,8 @@ fn _11() { #[rustc_dummy] for _ in 0..0 { #![rustc_dummy] }; - // FIXME: pp bug, two spaces after the loop let _ = - #[rustc_dummy] loop { + #[rustc_dummy] loop { #![rustc_dummy] }; let _ = #[rustc_dummy] match false { _ => (), };