diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2019-12-31 14:28:36 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2020-01-11 00:33:27 +0100 |
| commit | 51a73eb4fbbf2ec74c6a86942780fc2600811540 (patch) | |
| tree | 152fee1d76f11333ddd68d8ba38c3633888276f6 | |
| parent | 4beeadda3c137c8c8d66ba6b1bb3fb0be9b37b86 (diff) | |
| download | rust-51a73eb4fbbf2ec74c6a86942780fc2600811540.tar.gz rust-51a73eb4fbbf2ec74c6a86942780fc2600811540.zip | |
Avoid a duplicate hash map lookup
| -rw-r--r-- | src/librustc_mir/monomorphize/collector.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 422a1ccd9b5..e85e842031d 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/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 |
