Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum

fix pretty print for `loop`
This commit is contained in:
Yuki Okushi 2021-06-29 00:26:55 +09:00 committed by GitHub
commit de93434cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 5 deletions

View File

@ -1954,7 +1954,6 @@ fn print_expr_outer_attr_style(&mut self, expr: &ast::Expr, is_inline: bool) {
self.word_space(":");
}
self.head("loop");
self.s.space();
self.print_block_with_attrs(blk, attrs);
}
ast::ExprKind::Match(ref expr, ref arms) => {

View File

@ -1539,7 +1539,6 @@ pub fn print_expr(&mut self, expr: &hir::Expr<'_>) {
self.word_space(":");
}
self.head("loop");
self.s.space();
self.print_block(&blk);
}
hir::ExprKind::Match(ref expr, arms, _) => {

View File

@ -39,7 +39,7 @@ fn syntax() {
#![attr]
};
let _ =
#[attr] loop {
#[attr] loop {
#![attr]
};
let _ =

View File

@ -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 ; } }

View File

@ -0,0 +1,9 @@
// pretty-compare-only
// pretty-mode:hir
// pp-exact:hir-pretty-loop.pp
pub fn foo(){
loop{
break;
}
}

View File

@ -166,9 +166,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 _ =