Skip to content

Commit

Permalink
Fix logic error and add unreachable after returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Aatch committed Dec 18, 2014
1 parent b4f54f9 commit 5722410
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc/middle/graph.rs
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_trans/trans/expr.rs
Expand Up @@ -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
}
}
Expand Down

10 comments on commit 5722410

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at Aatch@5722410

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Aatch/rust/issue-19684 = 5722410 into auto

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "5bc0237050726945c1f08425c1bf7ee8e3bf897e"}

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aatch/rust/issue-19684 = 5722410 merged ok, testing candidate = 5bc02370

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at Aatch@5722410

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Aatch/rust/issue-19684 = 5722410 into auto

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "d6e3d8e5f7f1c12cc2954034acccd4356adaf4b6"}

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aatch/rust/issue-19684 = 5722410 merged ok, testing candidate = d6e3d8e5

@bors
Copy link
Contributor

@bors bors commented on 5722410 Dec 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.