diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2022-11-01 20:00:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-01 20:00:37 -0400 |
| commit | d4bd794f5e8c63dd22c3e7876eef026af4b93e1e (patch) | |
| tree | d66f8eb100ddb420b5116a935575fd2d7fd8d4bd | |
| parent | 3aae00428155e2b6d21ef638bbed272e49bc11e0 (diff) | |
| parent | 4a92cf61568b6be22a38d2c14bec41a271bbb571 (diff) | |
| download | rust-d4bd794f5e8c63dd22c3e7876eef026af4b93e1e.tar.gz rust-d4bd794f5e8c63dd22c3e7876eef026af4b93e1e.zip | |
Rollup merge of #103084 - inquisitivecrystal:control-flow, r=scottmcm
Derive `Eq` and `Hash` for `ControlFlow` There's really no reason for `ControlFlow` not to derive these traits. This is the part of #96416 that no one objected to, but that PR seems stale. The `Eq` derive was also [requested](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60ControlFlow.3A.20Eq.60/near/303610659) by `@lcnr` on Zulip to allow for pattern matching. This change requires an FCP because it's insta-stable. Closes #96416.
| -rw-r--r-- | library/core/src/ops/control_flow.rs | 4 |
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")] |
