Skip to content

Tracking issue for ? operator (RFC 243, question_mark) #31436

Closed

Description

@nikomatsakis

View all comments

Tracking issue for rust-lang/rfcs#243 and rust-lang/rfcs#1859.

See also the related tracking issue for try_trait_v2, #84277 (rust-lang/rfcs#3058)

"Try Blocks" (try { ... }) were previously tracked here, but moved to #154391

For heterogeneous try bikeshed MyType blocks, see #149488

Implementation concerns:

Activity

  1. added
    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
    T-langRelevant to the language team
    on Feb 5, 2016
  2. reem commented on Feb 5, 2016

    @reem
    Contributor

    The accompanying RFC discusses a desugaring based on labeled return/break, are we getting that too or will there just be special treatment for ? and catch in the compiler?

    EDIT: I think labeled return/break is an excellent idea separate from ? and catch, so if the answer is no I will probably open a separate RFC for it.

  3. nikomatsakis commented on Feb 5, 2016

    @nikomatsakis
    ContributorAuthor

    Labeled return/break is purely for explanatory purposes.

    On Fri, Feb 5, 2016 at 3:56 PM, Jonathan Reem notifications@github.com
    wrote:

    The accompanying RFC discusses a desugaring based on labeled return/break,
    are we getting that too or will there just be special treatment for ? and
    catch in the compiler?

    —
    Reply to this email directly or view it on GitHub
    #31436 (comment).

  4. glaebhoerl commented on Feb 5, 2016

    @glaebhoerl
    Contributor

    Another unresolved question we have to resolve before stabilizing is what the contract which impls of Into have to obey should be -- or whether Into is even the right trait to use for the error-upcasting here. (Perhaps this should be another checklist item?)

  5. petrochenkov commented on Feb 5, 2016

    @petrochenkov
    Contributor

    @reem

    I think labeled return/break is an excellent idea ... I will probably open a separate RFC for it.

    Please do!

  6. thepowersgang commented on Feb 6, 2016

    @thepowersgang
    Contributor

    On the subject of the Carrier trait, here is a gist example of such a trait I wrote back early in the RFC process.
    https://gist.github.com/thepowersgang/f0de63db1746114266d3

  7. petrochenkov commented on Feb 6, 2016

    @petrochenkov
    Contributor

    How this is treated during parsing?

    struct catch {
        a: u8
    }
    
    fn main() {
    
        let b = 10;
        catch { a: b } // struct literal or catch expression with type ascription inside?
    
    }
    
  8. eddyb commented on Feb 6, 2016

    @eddyb
    Contributor

    @petrochenkov Well, the definition couldn't affect parsing, but I think we still have a lookahead rule, based on the second token after {, : in this case, so it should still be parsed as a struct literal.

  9. petrochenkov commented on Feb 6, 2016

    @petrochenkov
    Contributor

    Also

    let c1 = catch { a: 10 };
    let c2 = catch { ..c1 }; // <--
    
    struct catch {}
    let c3 = catch {}; // <--
    

    + rust-lang/rfcs#306 if (when!) implemented.
    It seems like there are no conflicts besides struct literals.

    Given the examples above I'm for the simplest solution (as usual) - always treat catch { in expression positions as start of a catch block. Nobody calls their structures catch anyway.

  10. durka commented on Feb 6, 2016

    @durka
    Contributor

    It would be easier if a keyword was used instead of catch.

  11. bluss commented on Feb 6, 2016

    @bluss
    Contributor
  12. durka commented on Feb 6, 2016

    @durka
    Contributor

    @bluss yeah, I admit none of them are great... override seems like the only one that is close. Or we could use do, heh. Or a combination, though I don't see any great ones immediately. do catch?

  13. 501 remaining items

  14. added a commit that references this issue on Nov 30, 2025
  15. added
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    on Feb 14, 2026
  16. added a commit that references this issue on Mar 6, 2026
  17. added 3 commits that reference this issue on Mar 6, 2026
  18. added a commit that references this issue on Mar 6, 2026
  19. scottmcm commented on Mar 26, 2026

    @scottmcm
    Member

    Thanks for over 10 years (😮) of discussion on this issue! With the new RFC (rust-lang/rfcs#3721) merged, I'm going to move the try { ... } tracking to a new issue, #154391

    (Not closing now as the tracking issue number in source needs an update first.)

  20. changed the title [-]Tracking issue for `?` operator and `try` blocks (RFC 243, `question_mark` & `try_blocks` features)[/-] [+]Tracking issue for `?` operator (RFC 243, `question_mark`)[/+] on Mar 26, 2026
  21. added 2 commits that reference this issue on Mar 26, 2026
    9efe074
    e06b9bb
  22. added a commit that references this issue on Mar 30, 2026
    07e9777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-error-handlingArea: Error handlingB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-try_blocks`#![feature(try_blocks)]`I-libs-radarLibs issues that are tracked on the team's radar.S-tracking-design-concernsStatus: There are blocking design concerns.T-langRelevant to the language teamT-libs-api[DEPRECATED; DO NOT USE]T-typesRelevant to the types 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