Skip to content

Commit

Permalink
Avoid predecessors having Drop impls
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed May 8, 2021
1 parent 467253f commit 0367e24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/mir/mod.rs
Expand Up @@ -461,7 +461,7 @@ impl<'tcx> Body<'tcx> {
}

#[inline]
pub fn predecessors(&self) -> impl std::ops::Deref<Target = Predecessors> + '_ {
pub fn predecessors(&self) -> &Predecessors {
self.predecessor_cache.compute(&self.basic_blocks)
}

Expand Down Expand Up @@ -2815,13 +2815,13 @@ impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> {

impl graph::GraphPredecessors<'graph> for Body<'tcx> {
type Item = BasicBlock;
type Iter = smallvec::IntoIter<[BasicBlock; 4]>;
type Iter = std::iter::Copied<std::slice::Iter<'graph, BasicBlock>>;
}

impl graph::WithPredecessors for Body<'tcx> {
#[inline]
fn predecessors(&self, node: Self::Node) -> <Self as graph::GraphPredecessors<'_>>::Iter {
self.predecessors()[node].clone().into_iter()
self.predecessors()[node].iter().copied()
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/transform/coverage/graph.rs
Expand Up @@ -269,13 +269,13 @@ impl graph::WithSuccessors for CoverageGraph {

impl graph::GraphPredecessors<'graph> for CoverageGraph {
type Item = BasicCoverageBlock;
type Iter = std::vec::IntoIter<BasicCoverageBlock>;
type Iter = std::iter::Copied<std::slice::Iter<'graph, BasicCoverageBlock>>;
}

impl graph::WithPredecessors for CoverageGraph {
#[inline]
fn predecessors(&self, node: Self::Node) -> <Self as graph::GraphPredecessors<'_>>::Iter {
self.predecessors[node].clone().into_iter()
self.predecessors[node].iter().copied()
}
}

Expand Down

0 comments on commit 0367e24

Please sign in to comment.