Skip to content

Tracking Issue for constifying Result methods that drop values #92384

Closed

Description

@clarfonthey

Feature gate: #![feature(const_result_drop)]

Public API

This is a tracking issue for the const_result_drop feature, which includes constness for the following methods:

impl<T, E> Result<T, E> {
    // will drop error
    pub const fn ok(self) -> Option<T>
    where
        E: ~const Drop;

    // will drop ok
    pub const fn err(self) -> Option<E>
    where
        T: ~const Drop;

    // will drop error or the argument
    pub const fn and<U>(self, res: Result<U, E>) -> Result<U, E>
    where
        T: ~const Drop,
        U: ~const Drop,
        E: ~const Drop;
    
    // will drop ok or the argument
    pub const fn or<F>(self, res: Result<T, F>) -> Result<T, F>
    where
        T: ~const Drop,
        E: ~const Drop,
        F: ~const Drop;

    // will drop error or the argument
    pub const fn unwrap_or(self, default: T) -> T
    where
        T: ~const Drop,
        E: ~const Drop;
}

Note that these depend on the semantics for ~const Drop, which is (probably) tracked in #67792.

Steps / History

Unresolved Questions

  • None yet.

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    T-libs-api[DEPRECATED; DO NOT USE]
    on Dec 29, 2021
  2. clarfonthey commented on Dec 29, 2021

    @clarfonthey
    ContributorAuthor

    Turns out you actually can't make these const, at least for now. So, closing.

  3. clarfonthey commented on Dec 29, 2021

    @clarfonthey
    ContributorAuthor

    Reopened now that I've found a proper way to do this. Linked the tracking issue for ~const since this depends on the semantics of ~const Drop.

  4. changed the title [-]Tracking Issue for `const_result_option`[/-] [+]Tracking Issue for constifying `Result` methods that drop values[/+] on Jan 29, 2022
  5. added 2 commits that reference this issue on Mar 6, 2022
  6. added a commit that references this issue on Mar 8, 2022
  7. added a commit that references this issue on Mar 8, 2022
  8. jhpratt commented on Mar 17, 2022

    @jhpratt
    Member

    Duplicate of #82814?

  9. clarfonthey commented on Mar 17, 2022

    @clarfonthey
    ContributorAuthor

    That appears to be a meta tracking issue, this is specifically for these methods.

  10. jhpratt commented on Mar 17, 2022

    @jhpratt
    Member

    At least when I created it, it was not intended to be a meta issue. Result::as_mut, Result::transpose, and Result::flatten point directly to that as their tracking issue.

  11. clarfonthey commented on Mar 17, 2022

    @clarfonthey
    ContributorAuthor

    Yes, but for now, these methods point to this one, since they presumably would need their own FCP.

  12. jhpratt commented on Mar 17, 2022

    @jhpratt
    Member

    I figured it would be a partial stabilization of #82814. Not a big deal either way, just wanted to bring it to your attention 🙂

  13. RalfJung commented on Sep 8, 2024

    @RalfJung
    Member

    This got removed by #110393.

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

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]`T-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions