Skip to content

Commit 314e224

Browse files
committed
Streamline find_dep_kind_root.
`current_id` is removable.
1 parent f1ceedf commit 314e224

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • compiler/rustc_query_impl/src

compiler/rustc_query_impl/src/job.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,24 @@ pub(crate) fn find_cycle_in_stack<'tcx>(
8888
panic!("did not find a cycle")
8989
}
9090

91+
/// Finds the job closest to the root with a `DepKind` matching the `DepKind` of `id`.
9192
#[cold]
9293
#[inline(never)]
9394
pub(crate) fn find_dep_kind_root<'tcx>(
9495
id: QueryJobId,
9596
job_map: QueryJobMap<'tcx>,
9697
) -> (QueryJobInfo<'tcx>, usize) {
9798
let mut depth = 1;
98-
let info = &job_map.map[&id];
99+
let mut info = &job_map.map[&id];
99100
let dep_kind = info.frame.dep_kind;
100-
let mut current_id = info.job.parent;
101101
let mut last_layout = (info.clone(), depth);
102102

103-
while let Some(id) = current_id {
104-
let info = &job_map.map[&id];
103+
while let Some(id) = info.job.parent {
104+
info = &job_map.map[&id];
105105
if info.frame.dep_kind == dep_kind {
106106
depth += 1;
107107
last_layout = (info.clone(), depth);
108108
}
109-
current_id = info.job.parent;
110109
}
111110
last_layout
112111
}

0 commit comments

Comments
 (0)