Plumb awaitness of for loops
This commit is contained in:
parent
bf9229a2e3
commit
27d6539a46
26 changed files with 137 additions and 53 deletions
|
@ -1,5 +1,6 @@
|
|||
use crate::pp::Breaks::Inconsistent;
|
||||
use crate::pprust::state::{AnnNode, PrintState, State, INDENT_UNIT};
|
||||
use ast::ForLoopKind;
|
||||
use itertools::{Itertools, Position};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token;
|
||||
|
@ -418,20 +419,23 @@ impl<'a> State<'a> {
|
|||
self.space();
|
||||
self.print_block_with_attrs(blk, attrs);
|
||||
}
|
||||
ast::ExprKind::ForLoop(pat, iter, blk, opt_label) => {
|
||||
if let Some(label) = opt_label {
|
||||
ast::ExprKind::ForLoop { pat, iter, body, label, kind } => {
|
||||
if let Some(label) = label {
|
||||
self.print_ident(label.ident);
|
||||
self.word_space(":");
|
||||
}
|
||||
self.cbox(0);
|
||||
self.ibox(0);
|
||||
self.word_nbsp("for");
|
||||
if kind == &ForLoopKind::ForAwait {
|
||||
self.word_nbsp("await");
|
||||
}
|
||||
self.print_pat(pat);
|
||||
self.space();
|
||||
self.word_space("in");
|
||||
self.print_expr_as_cond(iter);
|
||||
self.space();
|
||||
self.print_block_with_attrs(blk, attrs);
|
||||
self.print_block_with_attrs(body, attrs);
|
||||
}
|
||||
ast::ExprKind::Loop(blk, opt_label, _) => {
|
||||
if let Some(label) = opt_label {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue