1
Fork 0

add #[rustc_pass_by_value] to more types

This commit is contained in:
lcnr 2022-03-08 15:39:52 +01:00
parent 67b3e81838
commit b8135fd5c8
27 changed files with 165 additions and 152 deletions

View file

@ -48,7 +48,7 @@ impl CoverageGraph {
let mut bcb_successors = Vec::new();
for successor in
bcb_filtered_successors(&mir_body, &bcb_data.terminator(mir_body).kind)
.filter_map(|&successor_bb| bb_to_bcb[successor_bb])
.filter_map(|successor_bb| bb_to_bcb[successor_bb])
{
if !seen[successor] {
seen[successor] = true;
@ -483,7 +483,7 @@ impl std::fmt::Debug for BcbBranch {
fn bcb_filtered_successors<'a, 'tcx>(
body: &'tcx &'a mir::Body<'tcx>,
term_kind: &'tcx TerminatorKind<'tcx>,
) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a> {
) -> Box<dyn Iterator<Item = BasicBlock> + 'a> {
let mut successors = term_kind.successors();
Box::new(
match &term_kind {
@ -494,9 +494,8 @@ fn bcb_filtered_successors<'a, 'tcx>(
// `next().into_iter()`) into the `mir::Successors` aliased type.
_ => successors.next().into_iter().chain(&[]),
}
.filter(move |&&successor| {
body[successor].terminator().kind != TerminatorKind::Unreachable
}),
.copied()
.filter(move |&successor| body[successor].terminator().kind != TerminatorKind::Unreachable),
)
}
@ -695,7 +694,7 @@ pub struct ShortCircuitPreorder<
F: Fn(
&'tcx &'a mir::Body<'tcx>,
&'tcx TerminatorKind<'tcx>,
) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a>,
) -> Box<dyn Iterator<Item = BasicBlock> + 'a>,
> {
body: &'tcx &'a mir::Body<'tcx>,
visited: BitSet<BasicBlock>,
@ -709,7 +708,7 @@ impl<
F: Fn(
&'tcx &'a mir::Body<'tcx>,
&'tcx TerminatorKind<'tcx>,
) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a>,
) -> Box<dyn Iterator<Item = BasicBlock> + 'a>,
> ShortCircuitPreorder<'a, 'tcx, F>
{
pub fn new(
@ -733,7 +732,7 @@ impl<
F: Fn(
&'tcx &'a mir::Body<'tcx>,
&'tcx TerminatorKind<'tcx>,
) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a>,
) -> Box<dyn Iterator<Item = BasicBlock> + 'a>,
> Iterator for ShortCircuitPreorder<'a, 'tcx, F>
{
type Item = (BasicBlock, &'a BasicBlockData<'tcx>);