1
Fork 0

fix pretty print for loop in mir and hir

This commit is contained in:
klensy 2021-06-16 13:25:00 +03:00
parent 52b22869db
commit ac72773215
6 changed files with 20 additions and 5 deletions

View file

@ -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) => {

View file

@ -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, _) => {

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

@ -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 { _ => (), };