Skip to content

catch blocks can produce non-Try values #43818

Closed
@scottmcm

Description

@scottmcm

This works today, and I think it's not supposed to:

let x: i32 = do catch { 4 };

Repro: https://play.rust-lang.org/?gist=0c5b165abf4c06ff5821550986db4531&version=nightly

The value that comes out of a catch seems like it's supposed to only be something that's Try, since otherwise you cannot use ? inside the catch. (Magic ok-wrapping could make the block itself legal, but it'd still need to return some impl Try<Ok=i32>, not a raw i32.)

cc catch tracking issue: #31436

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-needs-decisionIssue: In need of a decision.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions