1
Fork 0

query: minor refactoring

This commit is contained in:
ljedrz 2018-12-19 13:19:48 +01:00
parent d7ca075881
commit c2fa99d2c6
2 changed files with 3 additions and 10 deletions

View file

@ -406,7 +406,7 @@ fn remove_cycle<'tcx>(
// Find the queries in the cycle which are // Find the queries in the cycle which are
// connected to queries outside the cycle // connected to queries outside the cycle
let entry_points: Vec<_> = stack.iter().filter_map(|(span, query)| { let entry_points = stack.iter().filter_map(|(span, query)| {
if query.parent.is_none() { if query.parent.is_none() {
// This query is connected to the root (it has no query parent) // This query is connected to the root (it has no query parent)
Some((*span, query.clone(), None)) Some((*span, query.clone(), None))
@ -431,10 +431,7 @@ fn remove_cycle<'tcx>(
Some((*span, query.clone(), Some(waiter))) Some((*span, query.clone(), Some(waiter)))
} }
} }
}).collect(); }).collect::<Vec<(Span, Lrc<QueryJob<'tcx>>, Option<(Span, Lrc<QueryJob<'tcx>>)>)>>();
let entry_points: Vec<(Span, Lrc<QueryJob<'tcx>>, Option<(Span, Lrc<QueryJob<'tcx>>)>)>
= entry_points;
// Deterministically pick an entry point // Deterministically pick an entry point
let (_, entry_point, usage) = pick_query(tcx, &entry_points, |e| (e.0, e.1.clone())); let (_, entry_point, usage) = pick_query(tcx, &entry_points, |e| (e.0, e.1.clone()));

View file

@ -398,11 +398,7 @@ impl<'sess> OnDiskCache<'sess> {
-> Option<T> -> Option<T>
where T: Decodable where T: Decodable
{ {
let pos = if let Some(&pos) = index.get(&dep_node_index) { let pos = index.get(&dep_node_index).cloned()?;
pos
} else {
return None
};
// Initialize the cnum_map using the value from the thread which finishes the closure first // Initialize the cnum_map using the value from the thread which finishes the closure first
self.cnum_map.init_nonlocking_same(|| { self.cnum_map.init_nonlocking_same(|| {