diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-06-21 07:37:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-21 07:37:02 +0200 |
| commit | c6710d15f1228a5a3fda4c1aa307c3073ed83c9e (patch) | |
| tree | 3bfcdc2ff050b834f4c58dde27d4b902dfa63afc /src/tools/rustfmt | |
| parent | a98c14f3a9326e00d4c0734138308bf98206baa6 (diff) | |
| parent | b967f5c30d69fd44933ace40598eae6dfdeaa6a4 (diff) | |
| download | rust-c6710d15f1228a5a3fda4c1aa307c3073ed83c9e.tar.gz rust-c6710d15f1228a5a3fda4c1aa307c3073ed83c9e.zip | |
Rollup merge of #112790 - WaffleLapkin:syntactically, r=Nilstrieb
Syntactically accept `become` expressions (explicit tail calls experiment) This adds `ast::ExprKind::Become`, implements parsing and properly gates the feature. cc `@scottmcm`
Diffstat (limited to 'src/tools/rustfmt')
| -rw-r--r-- | src/tools/rustfmt/src/expr.rs | 1 | ||||
| -rw-r--r-- | src/tools/rustfmt/src/utils.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs index e179b4646ef..5600f7778f2 100644 --- a/src/tools/rustfmt/src/expr.rs +++ b/src/tools/rustfmt/src/expr.rs @@ -232,6 +232,7 @@ pub(crate) fn format_expr( ast::ExprKind::Ret(Some(ref expr)) => { rewrite_unary_prefix(context, "return ", &**expr, shape) } + ast::ExprKind::Become(ref expr) => rewrite_unary_prefix(context, "become ", &**expr, shape), ast::ExprKind::Yeet(None) => Some("do yeet".to_owned()), ast::ExprKind::Yeet(Some(ref expr)) => { rewrite_unary_prefix(context, "do yeet ", &**expr, shape) diff --git a/src/tools/rustfmt/src/utils.rs b/src/tools/rustfmt/src/utils.rs index ca171657407..890a05b8c82 100644 --- a/src/tools/rustfmt/src/utils.rs +++ b/src/tools/rustfmt/src/utils.rs @@ -505,6 +505,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr | ast::ExprKind::Range(..) | ast::ExprKind::Repeat(..) | ast::ExprKind::Ret(..) + | ast::ExprKind::Become(..) | ast::ExprKind::Yeet(..) | ast::ExprKind::Tup(..) | ast::ExprKind::Type(..) |
