diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2020-09-04 00:59:41 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2020-09-04 01:45:10 -0700 |
| commit | fac272688e9d561b1fff71621323682d23e4c31d (patch) | |
| tree | 6747b9151fd1a33ce4f6fe290c06c51db6257325 /compiler/rustc_data_structures/src/graph/iterate/mod.rs | |
| parent | 0d0f6b113047b2cf9afbde990cee30fd5b866469 (diff) | |
| download | rust-fac272688e9d561b1fff71621323682d23e4c31d.tar.gz rust-fac272688e9d561b1fff71621323682d23e4c31d.zip | |
Use ops::ControlFlow in graph::iterate
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/iterate/mod.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/iterate/mod.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_data_structures/src/graph/iterate/mod.rs b/compiler/rustc_data_structures/src/graph/iterate/mod.rs index 64ff6130ddf..8946666d961 100644 --- a/compiler/rustc_data_structures/src/graph/iterate/mod.rs +++ b/compiler/rustc_data_structures/src/graph/iterate/mod.rs @@ -87,11 +87,8 @@ where } /// Allows searches to terminate early with a value. -#[derive(Clone, Copy, Debug)] -pub enum ControlFlow<T> { - Break(T), - Continue, -} +// FIXME (#75744): remove the alias once the generics are in a better order and `C=()`. +pub type ControlFlow<T> = std::ops::ControlFlow<(), T>; /// The status of a node in the depth-first search. /// @@ -260,12 +257,12 @@ where _node: G::Node, _prior_status: Option<NodeStatus>, ) -> ControlFlow<Self::BreakVal> { - ControlFlow::Continue + ControlFlow::CONTINUE } /// Called after all nodes reachable from this one have been examined. fn node_settled(&mut self, _node: G::Node) -> ControlFlow<Self::BreakVal> { - ControlFlow::Continue + ControlFlow::CONTINUE } /// Behave as if no edges exist from `source` to `target`. @@ -290,7 +287,7 @@ where ) -> ControlFlow<Self::BreakVal> { match prior_status { Some(NodeStatus::Visited) => ControlFlow::Break(()), - _ => ControlFlow::Continue, + _ => ControlFlow::CONTINUE, } } } |
