diff options
| author | bors <bors@rust-lang.org> | 2022-08-26 03:23:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-26 03:23:54 +0000 |
| commit | 13a6aaffdf6bd6f1bce000b09aa390e93d6aca77 (patch) | |
| tree | 76d60e3604e38838c1f2203a916df062c3522e78 /compiler/rustc_transmute/src/layout/tree.rs | |
| parent | 76f3b891a0c48e128c5a43ef57e70d86735e1cf2 (diff) | |
| parent | b4d5f48e43f2f7d53ac058877e663229f1407e86 (diff) | |
| download | rust-13a6aaffdf6bd6f1bce000b09aa390e93d6aca77.tar.gz rust-13a6aaffdf6bd6f1bce000b09aa390e93d6aca77.zip | |
Auto merge of #101017 - JohnTitor:rollup-73f2fhb, r=JohnTitor
Rollup of 8 pull requests
Successful merges:
- #99064 (distinguish the method and associated function diagnostic information)
- #99920 (Custom allocator support in `rustc_serialize`)
- #100034 ( Elaborate all box dereferences in `ElaborateBoxDerefs`)
- #100076 (make slice::{split_at,split_at_unchecked} const functions)
- #100604 (Remove unstable Result::into_ok_or_err)
- #100933 (Reduce code size of `assert_matches_failed`)
- #100978 (Handle `Err` in `ast::LitKind::to_token_lit`.)
- #101010 (rustdoc: remove unused CSS for `.multi-column`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_transmute/src/layout/tree.rs')
| -rw-r--r-- | compiler/rustc_transmute/src/layout/tree.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 70b3ba02b05..93cab7ca533 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -1,4 +1,5 @@ use super::{Byte, Def, Ref}; +use std::ops::ControlFlow; #[cfg(test)] mod tests; @@ -86,17 +87,18 @@ where F: Fn(D) -> bool, { match self { - Self::Seq(elts) => elts - .into_iter() - .map(|elt| elt.prune(f)) - .try_fold(Tree::unit(), |elts, elt| { + Self::Seq(elts) => match elts.into_iter().map(|elt| elt.prune(f)).try_fold( + 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)) } - }) - .into_ok_or_err(), + }, + ) { + ControlFlow::Break(node) | ControlFlow::Continue(node) => node, + }, Self::Alt(alts) => alts .into_iter() .map(|alt| alt.prune(f)) |
