Stabilize const ControlFlow predicates

This commit is contained in:
nxsaken 2026-02-07 00:33:52 +04:00
parent bce89b6a56
commit 4b427b2f33

View file

@ -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 @@ 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_continue(&self) -> bool {
matches!(*self, ControlFlow::Continue(_))
}
@ -264,7 +264,7 @@ impl<B, C> ControlFlow<B, 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 break_ok(self) -> Result<B, C> {
match self {
ControlFlow::Continue(c) => Err(c),
@ -377,7 +377,7 @@ impl<B, C> ControlFlow<B, 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),