From c636ded2c759be0dc8fdb9143e06e420ef03ace3 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 26 Jul 2018 12:54:13 +0200 Subject: [PATCH] Improve the information provided when this assertion fails. --- src/librustc_mir/borrow_check/borrow_set.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index e9e0c5c36135..347bf61480ee 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -333,14 +333,21 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { // Consider the borrow not activated to start. When we find an activation, we'll update // this field. - let borrow_data = &mut self.idx_vec[borrow_index]; - borrow_data.activation_location = TwoPhaseActivation::NotActivated; + { + let borrow_data = &mut self.idx_vec[borrow_index]; + borrow_data.activation_location = TwoPhaseActivation::NotActivated; + } // Insert `temp` into the list of pending activations. From // now on, we'll be on the lookout for a use of it. Note that // we are guaranteed that this use will come after the // assignment. let old_value = self.pending_activations.insert(temp, borrow_index); - assert!(old_value.is_none()); + if let Some(old_index) = old_value { + span_bug!(self.mir.source_info(start_location).span, + "found already pending activation for temp: {:?} \ + at borrow_index: {:?} with associated data {:?}", + temp, old_index, self.idx_vec[old_index]); + } } }