diff options
| author | bors <bors@rust-lang.org> | 2021-08-18 10:43:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-18 10:43:27 +0000 |
| commit | ba8cda2fa2c99ed6646f4dfe73bf4edad7e42a2d (patch) | |
| tree | 7adfa942c13a620d7ea6e0a9c0bb80e4eb5dd480 /compiler/rustc_mir/src/transform/coverage/graph.rs | |
| parent | 896f058f13d6c8021f7637817953a44d3a78be32 (diff) | |
| parent | 0f081832b43db75073db2d8faecc84cf0ea7e271 (diff) | |
| download | rust-ba8cda2fa2c99ed6646f4dfe73bf4edad7e42a2d.tar.gz rust-ba8cda2fa2c99ed6646f4dfe73bf4edad7e42a2d.zip | |
Auto merge of #87781 - est31:remove_box, r=oli-obk
Remove box syntax from compiler and tools Removes box syntax from the compiler and tools. In #49733, the future of box syntax is uncertain and the use in the compiler was listed as one of the reasons to keep it. Removal of box syntax [might affect the code generated](https://github.com/rust-lang/rust/pull/49646#issuecomment-379219615) and slow down the compiler so I'd recommend doing a perf run on this.
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/graph.rs')
| -rw-r--r-- | compiler/rustc_mir/src/transform/coverage/graph.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/compiler/rustc_mir/src/transform/coverage/graph.rs b/compiler/rustc_mir/src/transform/coverage/graph.rs index 32febcec7af..d78ad6ce97f 100644 --- a/compiler/rustc_mir/src/transform/coverage/graph.rs +++ b/compiler/rustc_mir/src/transform/coverage/graph.rs @@ -491,15 +491,19 @@ fn bcb_filtered_successors<'a, 'tcx>( term_kind: &'tcx TerminatorKind<'tcx>, ) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a> { let mut successors = term_kind.successors(); - box match &term_kind { - // SwitchInt successors are never unwind, and all of them should be traversed. - TerminatorKind::SwitchInt { .. } => successors, - // For all other kinds, return only the first successor, if any, and ignore unwinds. - // NOTE: `chain(&[])` is required to coerce the `option::iter` (from - // `next().into_iter()`) into the `mir::Successors` aliased type. - _ => successors.next().into_iter().chain(&[]), - } - .filter(move |&&successor| body[successor].terminator().kind != TerminatorKind::Unreachable) + Box::new( + match &term_kind { + // SwitchInt successors are never unwind, and all of them should be traversed. + TerminatorKind::SwitchInt { .. } => successors, + // For all other kinds, return only the first successor, if any, and ignore unwinds. + // NOTE: `chain(&[])` is required to coerce the `option::iter` (from + // `next().into_iter()`) into the `mir::Successors` aliased type. + _ => successors.next().into_iter().chain(&[]), + } + .filter(move |&&successor| { + body[successor].terminator().kind != TerminatorKind::Unreachable + }), + ) } /// Maintains separate worklists for each loop in the BasicCoverageBlock CFG, plus one for the |
