Skip to content

Commit 98f3558

Browse files
authored
Rollup merge of #86994 - scottmcm:fix_expr_try_comment, r=petrochenkov
Update the comment on `lower_expr_try` I'd updated the ones inside the method, but not its doc comment.
2 parents 07b9dae + 099a357 commit 98f3558

File tree

1 file changed

+8
-7
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+8
-7
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1559,13 +1559,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
15591559

15601560
/// Desugar `ExprKind::Try` from: `<expr>?` into:
15611561
/// ```rust
1562-
/// match Try::into_result(<expr>) {
1563-
/// Ok(val) => #[allow(unreachable_code)] val,
1564-
/// Err(err) => #[allow(unreachable_code)]
1565-
/// // If there is an enclosing `try {...}`:
1566-
/// break 'catch_target Try::from_error(From::from(err)),
1567-
/// // Otherwise:
1568-
/// return Try::from_error(From::from(err)),
1562+
/// match Try::branch(<expr>) {
1563+
/// ControlFlow::Continue(val) => #[allow(unreachable_code)] val,,
1564+
/// ControlFlow::Break(residual) =>
1565+
/// #[allow(unreachable_code)]
1566+
/// // If there is an enclosing `try {...}`:
1567+
/// break 'catch_target Try::from_residual(residual),
1568+
/// // Otherwise:
1569+
/// return Try::from_residual(residual),
15691570
/// }
15701571
/// ```
15711572
fn lower_expr_try(&mut self, span: Span, sub_expr: &Expr) -> hir::ExprKind<'hir> {

0 commit comments

Comments
 (0)