diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index b9dcd083c0b8c..eb8e92f07eacc 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: `?` into: /// ```rust - /// match Try::into_result() { - /// 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() { + /// 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> {