about summary refs log tree commit diff
path: root/src/tools/rustfmt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-26 14:43:15 +0000
committerbors <bors@rust-lang.org>2024-02-26 14:43:15 +0000
commitb79db437dccd496948bb1819d36ed51598563a98 (patch)
treec8cff87bf2492d99dcd83ca3846dde57f7275853 /src/tools/rustfmt
parentb8de591b6556836633e0c1bce1f42b90801f4227 (diff)
parent34eae07ee52ea0c79b07babc39ae9f139a930091 (diff)
Auto merge of #120586 - ShE3py:exprkind-err, r=fmease
Add `ErrorGuaranteed` to `ast::ExprKind::Err`

See #119967 for context
```
      \
       \
          _~^~^~_
      \) /  o o  \ (/
        '_   -   _'
        / '-----' \
```

r? fmease
Diffstat (limited to 'src/tools/rustfmt')
-rw-r--r--src/tools/rustfmt/src/expr.rs2
-rw-r--r--src/tools/rustfmt/src/utils.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs
index 4b86c2acdc5..c500b30b998 100644
--- a/src/tools/rustfmt/src/expr.rs
+++ b/src/tools/rustfmt/src/expr.rs
@@ -404,7 +404,7 @@ pub(crate) fn format_expr(
             // These do not occur in the AST because macros aren't expanded.
             unreachable!()
         }
-        ast::ExprKind::Err => None,
+        ast::ExprKind::Err(_) | ast::ExprKind::Dummy => None,
     };
 
     expr_rw
diff --git a/src/tools/rustfmt/src/utils.rs b/src/tools/rustfmt/src/utils.rs
index 642b6603b1e..d4218cff75a 100644
--- a/src/tools/rustfmt/src/utils.rs
+++ b/src/tools/rustfmt/src/utils.rs
@@ -497,7 +497,8 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
         | ast::ExprKind::Break(..)
         | ast::ExprKind::Cast(..)
         | ast::ExprKind::Continue(..)
-        | ast::ExprKind::Err
+        | ast::ExprKind::Dummy
+        | ast::ExprKind::Err(_)
         | ast::ExprKind::Field(..)
         | ast::ExprKind::IncludedBytes(..)
         | ast::ExprKind::InlineAsm(..)