Skip to content

Commit

Permalink
Replace a try_fold in rustc_transmute to use ControlFlow instead of R…
Browse files Browse the repository at this point in the history
…esult
  • Loading branch information
dtolnay committed Aug 18, 2022
1 parent 83f081f commit 39809c5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/rustc_transmute/src/layout/tree.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{Byte, Def, Ref};
use std::ops::ControlFlow;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -90,13 +91,13 @@ where
Tree::unit(),
|elts, elt| {
if elt == Tree::uninhabited() {
Err(Tree::uninhabited())
ControlFlow::Break(Tree::uninhabited())
} else {
Ok(elts.then(elt))
ControlFlow::Continue(elts.then(elt))
}
},
) {
Err(node) | Ok(node) => node,
ControlFlow::Break(node) | ControlFlow::Continue(node) => node,
},
Self::Alt(alts) => alts
.into_iter()
Expand Down

0 comments on commit 39809c5

Please sign in to comment.