Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum
fix pretty print for `loop`
This commit is contained in:
commit
de93434cf0
@ -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) => {
|
||||
|
@ -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, _) => {
|
||||
|
@ -39,7 +39,7 @@ fn syntax() {
|
||||
#![attr]
|
||||
};
|
||||
let _ =
|
||||
#[attr] loop {
|
||||
#[attr] loop {
|
||||
#![attr]
|
||||
};
|
||||
let _ =
|
||||
|
9
src/test/pretty/hir-pretty-loop.pp
Normal file
9
src/test/pretty/hir-pretty-loop.pp
Normal 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 ; } }
|
9
src/test/pretty/hir-pretty-loop.rs
Normal file
9
src/test/pretty/hir-pretty-loop.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// pretty-compare-only
|
||||
// pretty-mode:hir
|
||||
// pp-exact:hir-pretty-loop.pp
|
||||
|
||||
pub fn foo(){
|
||||
loop{
|
||||
break;
|
||||
}
|
||||
}
|
@ -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 _ =
|
||||
|
Loading…
Reference in New Issue
Block a user