about summary refs log tree commit diff
diff options
context:
space:
mode:
authorinquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com>2022-10-15 02:50:17 -0700
committerinquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com>2022-10-19 13:25:34 -0700
commit4a92cf61568b6be22a38d2c14bec41a271bbb571 (patch)
tree9b875640df3bf5a83bed5af00d2edef122ece00c
parent46244f335b5262ef9bdc34cc564b4dea221948f6 (diff)
downloadrust-4a92cf61568b6be22a38d2c14bec41a271bbb571.tar.gz
rust-4a92cf61568b6be22a38d2c14bec41a271bbb571.zip
Derive `Eq` and `Hash` for `ControlFlow`
-rw-r--r--library/core/src/ops/control_flow.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs
index 72ebe653caf..cd183540cd5 100644
--- a/library/core/src/ops/control_flow.rs
+++ b/library/core/src/ops/control_flow.rs
@@ -79,7 +79,9 @@ use crate::{convert, ops};
 /// [`Break`]: ControlFlow::Break
 /// [`Continue`]: ControlFlow::Continue
 #[stable(feature = "control_flow_enum_type", since = "1.55.0")]
-#[derive(Debug, Clone, Copy, PartialEq)]
+// ControlFlow should not implement PartialOrd or Ord, per RFC 3058:
+// https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#traits-for-controlflow
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub enum ControlFlow<B, C = ()> {
     /// Move on to the next phase of the operation as normal.
     #[stable(feature = "control_flow_enum_type", since = "1.55.0")]