Auto merge of #152253 - nxsaken:stable_const_control_flow, r=dtolnay

Stabilize const ControlFlow predicates


Tracking issue: rust-lang/rust#148738
Related: rust-lang/rust#140266 (moved the relevant const-unstables to that feature)
r? @dtolnay
This commit is contained in:
bors 2026-02-07 03:40:48 +00:00
commit 56aaf58ec0

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),