Skip to content

Commit ba10b13

Browse files
authored
Rollup merge of rust-lang#59811 - vext01:dead-dominator-code, r=oli-obk
Kill dead code dominator code. Hi, Whilst fiddling around in the dominator code, I found some (I think) unused code. This code *was* used at the time it was imported, but over time it seems to have become redundant. I've tested a build up to stage 1 with no problems. Maybe the tests will turn up something though. P.S. There is a FIXME comment in `dominators/mod.rs`: ``` pub fn is_dominated_by(&self, node: Node, dom: Node) -> bool { // FIXME -- could be optimized by using post-order-rank self.dominators(node).any(|n| n == dom) } ``` I'm not sure of the intention of this comment. The `Dominators` struct already operates over post-order rank nodes. Any ideas?
2 parents f4c8cc9 + 3262d1e commit ba10b13

File tree

1 file changed

+0
-47
lines changed
  • src/librustc_data_structures/graph/dominators

1 file changed

+0
-47
lines changed

src/librustc_data_structures/graph/dominators/mod.rs

-47
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use super::super::indexed_vec::{Idx, IndexVec};
88
use super::iterate::reverse_post_order;
99
use super::ControlFlowGraph;
1010

11-
use std::fmt;
12-
1311
#[cfg(test)]
1412
mod test;
1513

@@ -158,48 +156,3 @@ impl<'dom, Node: Idx> Iterator for Iter<'dom, Node> {
158156
}
159157
}
160158
}
161-
162-
pub struct DominatorTree<N: Idx> {
163-
root: N,
164-
children: IndexVec<N, Vec<N>>,
165-
}
166-
167-
impl<Node: Idx> DominatorTree<Node> {
168-
pub fn children(&self, node: Node) -> &[Node] {
169-
&self.children[node]
170-
}
171-
}
172-
173-
impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
174-
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
175-
fmt::Debug::fmt(
176-
&DominatorTreeNode {
177-
tree: self,
178-
node: self.root,
179-
},
180-
fmt,
181-
)
182-
}
183-
}
184-
185-
struct DominatorTreeNode<'tree, Node: Idx> {
186-
tree: &'tree DominatorTree<Node>,
187-
node: Node,
188-
}
189-
190-
impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
191-
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
192-
let subtrees: Vec<_> = self.tree
193-
.children(self.node)
194-
.iter()
195-
.map(|&child| DominatorTreeNode {
196-
tree: self.tree,
197-
node: child,
198-
})
199-
.collect();
200-
fmt.debug_tuple("")
201-
.field(&self.node)
202-
.field(&subtrees)
203-
.finish()
204-
}
205-
}

0 commit comments

Comments
 (0)