Navigation Menu

Skip to content

Commit

Permalink
query: faster stack reversal in remove_cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Dec 19, 2018
1 parent e7b4bc3 commit 3294a69
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/librustc/ty/query/job.rs
Expand Up @@ -390,11 +390,9 @@ fn remove_cycle<'tcx>(
DUMMY_SP,
&mut stack,
&mut visited) {
// Reverse the stack so earlier entries require later entries
stack.reverse();

// The stack is a vector of pairs of spans and queries
let (mut spans, queries): (Vec<_>, Vec<_>) = stack.into_iter().unzip();
// The stack is a vector of pairs of spans and queries; reverse it so that
// the earlier entries require later entries
let (mut spans, queries): (Vec<_>, Vec<_>) = stack.into_iter().rev().unzip();

// Shift the spans so that queries are matched with the span for their waitee
spans.rotate_right(1);
Expand Down

0 comments on commit 3294a69

Please sign in to comment.