Skip to content
Permalink
Browse files

Avoid a duplicate hash map lookup

  • Loading branch information
Zoxc committed Dec 31, 2019
1 parent 4beeadd commit 51a73eb4fbbf2ec74c6a86942780fc2600811540
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/librustc_mir/monomorphize/collector.rs
@@ -227,10 +227,7 @@ impl<'tcx> InliningMap<'tcx> {
}
}

fn record_accesses(&mut self, source: MonoItem<'tcx>, new_targets: &[(MonoItem<'tcx>, bool)])
{
assert!(!self.index.contains_key(&source));

fn record_accesses(&mut self, source: MonoItem<'tcx>, new_targets: &[(MonoItem<'tcx>, bool)]) {
let start_index = self.targets.len();
let new_items_count = new_targets.len();
let new_items_count_total = new_items_count + self.targets.len();
@@ -246,7 +243,7 @@ impl<'tcx> InliningMap<'tcx> {
}

let end_index = self.targets.len();
self.index.insert(source, (start_index, end_index));
assert!(self.index.insert(source, (start_index, end_index)).is_none());
}

// Internally iterate over all items referenced by `source` which will be

0 comments on commit 51a73eb

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