mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Stabilize const ControlFlow predicates
This commit is contained in:
@@ -151,7 +151,7 @@ impl<B, C> ControlFlow<B, C> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "control_flow_enum_is", since = "1.59.0")]
|
||||
#[rustc_const_unstable(feature = "min_const_control_flow", issue = "148738")]
|
||||
#[rustc_const_stable(feature = "min_const_control_flow", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn is_break(&self) -> bool {
|
||||
matches!(*self, ControlFlow::Break(_))
|
||||
}
|
||||
@@ -168,7 +168,7 @@ pub const fn is_break(&self) -> bool {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "control_flow_enum_is", since = "1.59.0")]
|
||||
#[rustc_const_unstable(feature = "min_const_control_flow", issue = "148738")]
|
||||
#[rustc_const_stable(feature = "min_const_control_flow", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn is_continue(&self) -> bool {
|
||||
matches!(*self, ControlFlow::Continue(_))
|
||||
}
|
||||
@@ -264,7 +264,7 @@ pub const fn break_value(self) -> Option<B>
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "control_flow_ok", issue = "140266")]
|
||||
#[rustc_const_unstable(feature = "min_const_control_flow", issue = "148738")]
|
||||
#[rustc_const_unstable(feature = "control_flow_ok", issue = "140266")]
|
||||
pub const fn break_ok(self) -> Result<B, C> {
|
||||
match self {
|
||||
ControlFlow::Continue(c) => Err(c),
|
||||
@@ -377,7 +377,7 @@ pub const fn continue_value(self) -> Option<C>
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "control_flow_ok", issue = "140266")]
|
||||
#[rustc_const_unstable(feature = "min_const_control_flow", issue = "148738")]
|
||||
#[rustc_const_unstable(feature = "control_flow_ok", issue = "140266")]
|
||||
pub const fn continue_ok(self) -> Result<C, B> {
|
||||
match self {
|
||||
ControlFlow::Continue(c) => Ok(c),
|
||||
|
||||
Reference in New Issue
Block a user