about summary refs log tree commit diff
path: root/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2023-12-08 14:51:50 -0800
committerEric Holk <ericholk@microsoft.com>2023-12-19 12:26:20 -0800
commit27d6539a46123dcdb6fae6e043b8c1c12b3e0d6f (patch)
treeb57c35ff3b5d0f5ddd5ff8060acdcf1d8f0f2ace /compiler/rustc_ast_pretty/src/pprust/state/expr.rs
parentbf9229a2e366b4c311f059014a4aa08af16de5d8 (diff)
downloadrust-27d6539a46123dcdb6fae6e043b8c1c12b3e0d6f.tar.gz
rust-27d6539a46123dcdb6fae6e043b8c1c12b3e0d6f.zip
Plumb awaitness of for loops
Diffstat (limited to 'compiler/rustc_ast_pretty/src/pprust/state/expr.rs')
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index f5ffcddb83d..f868beec812 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
@@ -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 {