From 27d6539a46123dcdb6fae6e043b8c1c12b3e0d6f Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Fri, 8 Dec 2023 14:51:50 -0800 Subject: [PATCH 1/3] Plumb awaitness of for loops --- compiler/rustc_ast/src/ast.rs | 13 +++++++--- compiler/rustc_ast/src/mut_visit.rs | 2 +- compiler/rustc_ast/src/util/classify.rs | 14 ++++++++--- compiler/rustc_ast/src/visit.rs | 10 ++++---- compiler/rustc_ast_lowering/src/expr.rs | 9 +++---- compiler/rustc_ast_passes/src/feature_gate.rs | 1 + .../rustc_ast_pretty/src/pprust/state/expr.rs | 10 +++++--- .../src/assert/context.rs | 2 +- compiler/rustc_feature/src/unstable.rs | 2 ++ compiler/rustc_lint/src/unused.rs | 6 ++--- compiler/rustc_parse/src/parser/expr.rs | 20 +++++++++++----- compiler/rustc_resolve/src/late.rs | 6 ++--- .../rustc_resolve/src/late/diagnostics.rs | 2 +- compiler/rustc_span/src/symbol.rs | 1 + .../clippy_lints/src/needless_continue.rs | 6 ++++- .../clippy/clippy_lints/src/redundant_else.rs | 2 +- .../src/suspicious_operation_groupings.rs | 2 +- .../clippy/clippy_utils/src/ast_utils.rs | 19 ++++++++++++--- src/tools/clippy/clippy_utils/src/sugg.rs | 2 +- src/tools/rustfmt/src/closures.rs | 4 ++-- src/tools/rustfmt/src/expr.rs | 24 +++++++++++++------ src/tools/rustfmt/src/matches.rs | 2 +- src/tools/rustfmt/src/overflow.rs | 2 +- src/tools/rustfmt/src/utils.rs | 4 ++-- .../ui/async-await/feature-async-for-loop.rs | 14 +++++++++++ .../async-await/feature-async-for-loop.stderr | 11 +++++++++ 26 files changed, 137 insertions(+), 53 deletions(-) create mode 100644 tests/ui/async-await/feature-async-for-loop.rs create mode 100644 tests/ui/async-await/feature-async-for-loop.stderr diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 9d543563c0f96..8a0fbdd1357ae 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -1274,7 +1274,7 @@ impl Expr { ExprKind::Let(..) => ExprPrecedence::Let, ExprKind::If(..) => ExprPrecedence::If, ExprKind::While(..) => ExprPrecedence::While, - ExprKind::ForLoop(..) => ExprPrecedence::ForLoop, + ExprKind::ForLoop { .. } => ExprPrecedence::ForLoop, ExprKind::Loop(..) => ExprPrecedence::Loop, ExprKind::Match(..) => ExprPrecedence::Match, ExprKind::Closure(..) => ExprPrecedence::Closure, @@ -1436,10 +1436,10 @@ pub enum ExprKind { While(P, P, Option