diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index b760a7c4e21eb..e426ff7cc057a 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -150,7 +150,8 @@ impl ControlFlow { /// ``` #[inline] #[stable(feature = "control_flow_enum_is", since = "1.59.0")] - pub fn is_break(&self) -> bool { + #[rustc_const_unstable(feature = "const_control_flow", issue = "none")] + pub const fn is_break(&self) -> bool { matches!(*self, ControlFlow::Break(_)) } @@ -166,7 +167,8 @@ impl ControlFlow { /// ``` #[inline] #[stable(feature = "control_flow_enum_is", since = "1.59.0")] - pub fn is_continue(&self) -> bool { + #[rustc_const_unstable(feature = "const_control_flow", issue = "none")] + pub const fn is_continue(&self) -> bool { matches!(*self, ControlFlow::Continue(_)) } @@ -257,7 +259,8 @@ impl ControlFlow { /// ``` #[inline] #[unstable(feature = "control_flow_ok", issue = "140266")] - pub fn break_ok(self) -> Result { + #[rustc_const_unstable(feature = "const_control_flow", issue = "none")] + pub const fn break_ok(self) -> Result { match self { ControlFlow::Continue(c) => Err(c), ControlFlow::Break(b) => Ok(b), @@ -361,7 +364,8 @@ impl ControlFlow { /// ``` #[inline] #[unstable(feature = "control_flow_ok", issue = "140266")] - pub fn continue_ok(self) -> Result { + #[rustc_const_unstable(feature = "const_control_flow", issue = "none")] + pub const fn continue_ok(self) -> Result { match self { ControlFlow::Continue(c) => Ok(c), ControlFlow::Break(b) => Err(b),