Skip to content
Permalink
Browse files

Fix a deadlock

  • Loading branch information
Zoxc committed Dec 31, 2019
1 parent f3ce144 commit 4beeadda3c137c8c8d66ba6b1bb3fb0be9b37b86
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/librustc_mir/monomorphize/collector.rs
@@ -194,7 +194,7 @@ use rustc_hir as hir;
use rustc_hir::def_id::{DefId, DefIdMap, LOCAL_CRATE};
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_index::bit_set::GrowableBitSet;

use smallvec::SmallVec;
use std::iter;

#[derive(PartialEq)]
@@ -227,9 +227,7 @@ impl<'tcx> InliningMap<'tcx> {
}
}

fn record_accesses<I>(&mut self, source: MonoItem<'tcx>, new_targets: I)
where
I: Iterator<Item = (MonoItem<'tcx>, bool)> + ExactSizeIterator,
fn record_accesses(&mut self, source: MonoItem<'tcx>, new_targets: &[(MonoItem<'tcx>, bool)])
{
assert!(!self.index.contains_key(&source));

@@ -240,9 +238,9 @@ impl<'tcx> InliningMap<'tcx> {
self.targets.reserve(new_items_count);
self.inlines.ensure(new_items_count_total);

for (i, (target, inline)) in new_targets.enumerate() {
self.targets.push(target);
if inline {
for (i, (target, inline)) in new_targets.iter().enumerate() {
self.targets.push(*target);
if *inline {
self.inlines.insert(i + start_index);
}
}
@@ -403,10 +401,12 @@ fn record_accesses<'tcx>(
mono_item.instantiation_mode(tcx) == InstantiationMode::LocalCopy
};

let accesses =
callees.into_iter().map(|mono_item| (*mono_item, is_inlining_candidate(mono_item)));
let accesses: SmallVec<[_; 128]> = callees
.into_iter()
.map(|mono_item| (*mono_item, is_inlining_candidate(mono_item)))
.collect();

inlining_map.lock_mut().record_accesses(caller, accesses);
inlining_map.lock_mut().record_accesses(caller, &accesses);
}

fn check_recursion_limit<'tcx>(

0 comments on commit 4beeadd

Please sign in to comment.
You can’t perform that action at this time.