Fix logic error and add unreachable after returns
This commit is contained in:
parent
b4f54f96df
commit
5722410f72
@ -314,7 +314,7 @@ pub struct DepthFirstTraversal<'g, N:'g, E:'g> {
|
||||
impl<'g, N, E> Iterator<&'g N> for DepthFirstTraversal<'g, N, E> {
|
||||
fn next(&mut self) -> Option<&'g N> {
|
||||
while let Some(idx) = self.stack.pop() {
|
||||
if self.visited.insert(idx.node_id()) {
|
||||
if !self.visited.insert(idx.node_id()) {
|
||||
continue;
|
||||
}
|
||||
self.graph.each_outgoing_edge(idx, |_, e| -> bool {
|
||||
|
@ -945,6 +945,10 @@ fn trans_rvalue_stmt_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
if let &Some(ref x) = ex {
|
||||
bcx = trans_into(bcx, &**x, Ignore);
|
||||
}
|
||||
// Mark the end of the block as unreachable. Once we get to
|
||||
// a return expression, there's no more we should be doing
|
||||
// after this.
|
||||
Unreachable(bcx);
|
||||
bcx
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user