Skip to content

Commit

Permalink
Rollup merge of #86994 - scottmcm:fix_expr_try_comment, r=petrochenkov
Browse files Browse the repository at this point in the history
Update the comment on `lower_expr_try`

I'd updated the ones inside the method, but not its doc comment.
  • Loading branch information
m-ou-se authored Jul 9, 2021
2 parents 07b9dae + 099a357 commit 98f3558
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 98f3558

Please sign in to comment.