fix pretty print for loop
in mir and hir
This commit is contained in:
parent
52b22869db
commit
ac72773215
6 changed files with 20 additions and 5 deletions
|
@ -1950,7 +1950,6 @@ impl<'a> State<'a> {
|
||||||
self.word_space(":");
|
self.word_space(":");
|
||||||
}
|
}
|
||||||
self.head("loop");
|
self.head("loop");
|
||||||
self.s.space();
|
|
||||||
self.print_block_with_attrs(blk, attrs);
|
self.print_block_with_attrs(blk, attrs);
|
||||||
}
|
}
|
||||||
ast::ExprKind::Match(ref expr, ref arms) => {
|
ast::ExprKind::Match(ref expr, ref arms) => {
|
||||||
|
|
|
@ -1538,7 +1538,6 @@ impl<'a> State<'a> {
|
||||||
self.word_space(":");
|
self.word_space(":");
|
||||||
}
|
}
|
||||||
self.head("loop");
|
self.head("loop");
|
||||||
self.s.space();
|
|
||||||
self.print_block(&blk);
|
self.print_block(&blk);
|
||||||
}
|
}
|
||||||
hir::ExprKind::Match(ref expr, arms, _) => {
|
hir::ExprKind::Match(ref expr, arms, _) => {
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn syntax() {
|
||||||
#![attr]
|
#![attr]
|
||||||
};
|
};
|
||||||
let _ =
|
let _ =
|
||||||
#[attr] loop {
|
#[attr] loop {
|
||||||
#![attr]
|
#![attr]
|
||||||
};
|
};
|
||||||
let _ =
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -159,9 +159,8 @@ fn _11() {
|
||||||
#[rustc_dummy] for _ in 0..0 {
|
#[rustc_dummy] for _ in 0..0 {
|
||||||
#![rustc_dummy]
|
#![rustc_dummy]
|
||||||
};
|
};
|
||||||
// FIXME: pp bug, two spaces after the loop
|
|
||||||
let _ =
|
let _ =
|
||||||
#[rustc_dummy] loop {
|
#[rustc_dummy] loop {
|
||||||
#![rustc_dummy]
|
#![rustc_dummy]
|
||||||
};
|
};
|
||||||
let _ = #[rustc_dummy] match false { _ => (), };
|
let _ = #[rustc_dummy] match false { _ => (), };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue