-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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
- Implementation: Add Result::{ok, err, and, or, unwrap_or} as const #92385
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- None yet.
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.