diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index b9dcd083c0b..eb8e92f07ea 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1559,13 +1559,14 @@ impl<'hir> LoweringContext<'_, 'hir> { /// Desugar `ExprKind::Try` from: `<expr>?` into: /// ```rust - /// match Try::into_result(<expr>) { - /// Ok(val) => #[allow(unreachable_code)] val, - /// Err(err) => #[allow(unreachable_code)] - /// // If there is an enclosing `try {...}`: - /// break 'catch_target Try::from_error(From::from(err)), - /// // Otherwise: - /// return Try::from_error(From::from(err)), + /// match Try::branch(<expr>) { + /// ControlFlow::Continue(val) => #[allow(unreachable_code)] val,, + /// ControlFlow::Break(residual) => + /// #[allow(unreachable_code)] + /// // If there is an enclosing `try {...}`: + /// break 'catch_target Try::from_residual(residual), + /// // Otherwise: + /// return Try::from_residual(residual), /// } /// ``` fn lower_expr_try(&mut self, span: Span, sub_expr: &Expr) -> hir::ExprKind<'hir> { |
